Link to home
Start Free TrialLog in
Avatar of mte01
mte01Flag for Lebanon

asked on

.net webservice result always is NOTHING

Dhaest your help is appreciated if you can.

my webservice takes as parameter an OMElement and returns an OMElment, following is the webservice java implementation:

public OMElement getBodyParts2(OMElement element)
   {
      OMElement dataElement = element.getFirstElement();
      String xmlData = dataElement.getText();
      try
      {
         return dataElement;
      }
      catch(Exception e)
      {
         return null;
      }
  }

and here is the services.xml

<service name="BodyPartService" scope="application">
 <description> Body Part Web Service </description>
 <operation name="getBodyParts">
  <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
 </operation>
 <operation name="getBodyParts2">
 <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
 </operation>
 <parameter name="ServiceClass">com.compressus.wlclient.service.BodyPartService</parameter>
</service>


VB.net code that calls the webservice:
 Dim xx As New web.BodyPartService("localhost", 8080)
        Dim ds As New DataSet
        ds.EnforceConstraints = False
        ds.ReadXml("c:\data.xml")
        dim o = xx.getBodyParts2(ds.GetXml)
-------------------------------
my problem:
i was able to send the xml data taken from the file data.xml, but the return result is always nothing. any idea how can i fix that..
best.

Avatar of mte01
mte01
Flag of Lebanon image

ASKER

I saw the same problem with no solution on JavaRanch.

http://www.coderanch.com/t/221592/Web-Services/java/Net-Client-Axis-Web-services
Avatar of mte01

ASKER

Hi Guys,
i did change the java web-service and return the following:

         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
         SOAPEnvelope envelope = fac.getDefaultEnvelope();
         OMNamespace omNs =   fac.createOMNamespace(
             "http://service.wlclient.compressus.com", "ns1");
         OMElement method = fac.createOMElement("echo", omNs);
         OMElement value = fac.createOMElement("echo", omNs);
         value.setText("Hello");
         method.addChild(value);
         envelope.getBody().addChild(method);
         return envelope;


Now a new error is being displayed on the .net part after getting the results, following is the exception message:

>> An unhandled exception of type 'System.Web.Services.Protocols.SoapException' occurred in system.web.services.dll

>> Additional information: Can not output XML declaration, after other output has already been done.


thanks in advance


ASKER CERTIFIED SOLUTION
Avatar of bilani
bilani

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial