Solved

.net webservice result always is NOTHING

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Definitions and default visual studio colors 5 58
Need to pass a connection through class/Method 1 40
Problem to error 4 47
Tool Box 2 35
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

864 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

25 Experts available now in Live!

Get 1:1 Help Now