• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

.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.

0
mte01
Asked:
mte01
  • 2
1 Solution
 
mte01Author Commented:
I saw the same problem with no solution on JavaRanch.

http://www.coderanch.com/t/221592/Web-Services/java/Net-Client-Axis-Web-services
0
 
mte01Author Commented:
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


0
 
bilaniCommented:
Workaround have been posted on:
http://www.codeproject.com/KB/webservices/Java_WS_NET.aspx

The problem was solved by creating a new class that inherits from "the webservice" and overriding the GetWebResponse function to capture the full, correct SOAP response to a variable of mine and then parse the SOAP envelope manually.
Good Luck
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now