Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in sending SOAP message using SAAJ on web service implemented in .NET

 
Sumit Bansal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am creating a SOAP message (StringBuffer to byte array, byte array to InputStream) using "SOAPMessage message = messageFactory.createMessage(mh,in);"
and sending it to a Web Service which is implemented in .NET on IIS Server.
On "SOAPMessage reply = soapConnection.call(message, url);" this l;ine of code i am getting Excetion.

Feb 28, 2007 10:56:28 AM com.sun.xml.messaging.saaj.soap.MessageImpl identifyContentType
SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
.
.
.
.
Exception caught:java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message

I just want to send a SOAP message from Tomcat server and get a reply from a web service that is implemented on IIS server.
any reply related to this will be appreciated.

Thanks.
 
Sumit Bansal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

first of all thanks for reading my message.
i am explaining it a little more.....
Web service, that is implemented on .NET platform, also runs on secure layer.
and Tomcat server want to interact with that web service. Please tell me the detail of jar files which i need to copy in WEB-INF/lib folder and which jar files should be in class path.

waiting for a response.

sumit
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As to your first question, what does the WS return - is it actually HTML, or is it SOAP with an incorrect MIME type?

As to the second one, Axis comes with all required libraries. Nothing else needs to be put into WEB-INF/lib.
 
Sumit Bansal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thank you for replying "Ulf Dittmer".
That WS return a soap message itself and the content type of that is XML.

You are asking about the return type of WS, does it mean my SOAP message is going to that WS but i am getting incorrect reply from there.. How can one confirm this??

Thank you very much.

sumit
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That WS return a soap message itself and the content type of that is XML.

The client seems to think that the MIME type is "text/html" -that's what the error message says-, so there is a disconnect somewhere. Use an HTTP sniffer to determine what MIME type is set in the HTTP header. If it is text/html, then the server is incorrectly setting that header.

By the way, since your name seems to be "sumit", your diplay name is not correct. We have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
 
Sumit Bansal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have checked the server is sending right type "text/xml".
Please just have a look on my code. Please Suggest me somthing I am new to WS.
*******************************************************
// creating a SOAP Message from StringBuffer to Input Stream to SOAP Msg
StringBuffer sb1 = new StringBuffer();
sb1.append("<?xml version='1.0' encoding='utf-8'?>");
sb1.append("<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>");
sb1.append("<soap:Body>");
sb1.append("<AuthenticateUser xmlns='http://LoginAuth.com/webservices'>");
sb1.append("<AuthKey>hjhjkhkjjkjk</AuthKey>");
sb1.append("</AuthenticateUser>");
sb1.append("</soap:Body>");
sb1.append("</soap:Envelope>");

String strSoap=sb1.toString();
//"strSoap" is the SOAP message i have to send to get a reply.

byte[] b = strSoap.getBytes("UTF-8");
InputStream in = new ByteArrayInputStream(b);

MimeHeaders mh = new MimeHeaders();
mh.setHeader("Content-Type", "text/xml");

MessageFactory mf = MessageFactory.newInstance();
SOAPMessage message = mf.createMessage(mh,in);

//Here I am getting the error..................
SOAPMessage reply = soapConnection.call(message, url);

.
.
.
The exception i am getting is..................

Mar 1, 2007 3:22:02 PM com.sun.xml.messaging.saaj.soap.MessageImpl identifyContentType
SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
at com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:296)
.
.
.
.
Exception caught:java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize message

Sumit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic