2015-03-02 71 views
0

我面臨同樣的問題。這是我的蹤跡。如果沒有Web服務客戶端代碼,我嘗試使用java形成SOAP請求xml,並向Web服務端點發送請求。使用java standalone無需客戶端代碼的WebService調用

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 

當我複製從Java生成的XML與SOAP UI,其完美的罰款,但使用它時,我送用java SOAP連接器,其拋出上述錯誤。請幫助我

回答

0

嘗試使用Java的WSDL生成器之一。它會使你的編碼更容易。 E.g:http://www.eclipse.org/webtools/community/education/web/t320/Generating_a_client_from_WSDL.pdfhttp://netbeans.dzone.com/news/5-techniques-create-web-servic

如果你真的想用手做,你需要查找標準要求的SOAP數據包。 XML必須符合規格。

+0

實際的問題迫使我們去與沒有存根的Web服務調用。我們有一個不允許第三方罐子的產品。所以我們轉到沒有客戶端代碼的Web服務調用。不知道我應該從哪裏開始排除故障。如果有人能指導我,那就太棒了。 – 2015-03-02 22:34:16

相關問題