472,133 Members | 1,184 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

Calling Java Web Service as a soap request from .Net(C#)

Hi Friends,
I am trying to call a Java Web Service from .Net using C#. This is a SOAP request that I am making.

XmlDocument xmlDoc = new XmlDocument();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Headers.Add("SOAPAction", "\"\"");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);
string sRet = r.ReadToEnd();
WriteLogFile("SOAP Response:" + sRet);
return sRet;

When I try the above request it fails and the Java client doesnt get any request message. But when I change the
req.Method = "POST"; to
req.Method = "updateTableFromXML";
then the java client can see the message with the method name(UPDATETABLEFROMXML) that I am calling in the web service.
Now they want me to send the parameter along with the method name. I am having difficulties in sending this parameter which is an xml file stored in an string.
Please advice how can i resolve this issue.

Feb 7 '07 #1
2 10277
The above method worked for me.
req.method = "POST";

The problem was I was trying to access a web service which has soap format as RPC. In Java the request will work fine because soap opertion style is RPC by default and in .Net it gives problem as Document is the default.

Feb 7 '07 #2
4,871 Expert 4TB
Well done, thanks for letting us know the solution :).
Feb 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Christian Wilhelm | last post: by
3 posts views Thread by Jerome Cohen | last post: by
7 posts views Thread by Jorgen Haukland, Norway | last post: by
1 post views Thread by jens Jensen | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.