0

I am facing same problem. here is the my trace. Without web service client code, I am trying to form SOAP request xml using java and send request to web service endpoint.

SEVERE: SAAJ0008: Bad Response; Cannot process the message because the content type 'text/xml' was not the expected type 'application/soap+xml; charset=utf-8'.
Error occurred while sending SOAP Request to Server
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (415Cannot process the message because the content type 'text/xml' was not the expected type 'application/soap+xml; charset=utf-8'.
      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(Unknown Source)
      at com.optus.idm.util.BaseBean.getPinStatus(BaseBean.java:220)
      at com.optus.idm.util.BaseBean.main(BaseBean.java:247)
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (415Cannot process the message because the content type 'text/xml' was not the expected type 'application/soap+xml; charset=utf-8'.
      at java.security.AccessController.doPrivileged(Native Method)
      ... 3 more
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (415Cannot process the message because the content type 'text/xml' was not the expected type 'application/soap+xml; charset=utf-8'.
      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(Unknown Source)
      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(Unknown Source)
      ... 4 more

When I copy generated XML from java and use it with SOAP UI, its perfectly fine but when I send using java soap connector, its throwing above error. Please help me

pherris
  • 17,195
  • 8
  • 42
  • 58

1 Answers1

0

Try using one of Java's WSDL generators. It will make your coding easier. E.g: http://www.eclipse.org/webtools/community/education/web/t320/Generating_a_client_from_WSDL.pdf or http://netbeans.dzone.com/news/5-techniques-create-web-servic

If you really want to do by hand, you need to look up the standard requirements for a SOAP packet. The XML must conform to the specs.

Bacchus
  • 121
  • 2
  • Actual problem forced us to go with Web service call without stub. We have a product which does not allowing third party jars inside of it. So we moved to web service call without client code. Not sure where should i start troubleshooting. If someone can direct me right way, that will be great. – Technology Solutions Mar 02 '15 at 22:34