Solved

.net webservice result always is NOTHING

Posted on 2009-04-07
3
244 Views
Last Modified: 2013-12-17
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
Comment
Question by:mte01
  • 2
3 Comments
 
LVL 3

Author Comment

by:mte01
ID: 24087572
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
 
LVL 3

Author Comment

by:mte01
ID: 24094343
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
 
LVL 2

Accepted Solution

by:
bilani earned 500 total points
ID: 24156390
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now