开发者

.net Client consuming Axis2 Web Service

I have an .net 2.0 C# client app that has a web service reference to an Axis2 Java Webservice. The idea is to send some xml data to the webservice, so it can be parsed and inserted into database. The WS method accepts a single parameter of type 'xsd:anytype'.

Java web service:

public class JWS{    
    public Response AddData(Object inputXML) {            
        return Response;
    }  
}

C# Client:

JWS client = new JWS();
object inputXML = "<xml>some xml data</xml>";
response = client.AddData(inputXML);

There are 2 issues i am seeing when monitored using fiddler.

1) The request has an additional element '<inputXML>' added before the actual xml data.

<inputXML>&lt;xml&gt;some xml data&lt;/xml&gt;</inputXML>

2) The xml is encoded, so '<' is appearing as "&lt;"

I am not sure if this is how SOAP request's are generated but i would like to remove the <inputXML> tag and also, have the xml appear as开发者_JS百科 is without having to replace the special characters.

Is this possible? Is it got something to do with 'Wrapping'/'UnWrapping' Types?

Also, i have used SoapUI to test the java web service and it works well. However, in the request tab, i had to manually remove the <inputXML> tag and submit for it to work correctly. Please help.

TIA


This is expected behaviour under SOAP and the inputXml variable will be decoded back to the original string when passed to your web service method.

However this may indicate a problem with your design, have you considered constructing an object to send to your web service rather than xml data? (As this object will transparently be converted to xml for the web service call anyway).


I found out that the issue is not with encoding but it was interpreted incorrectly on java side when the message was viewed in axis2. So, it is getting decoded properly. Also, the inputxml is now being handled correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜