Solved

.net webservice result always is NOTHING

Posted on 2009-04-07
3
247 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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