我正在对 SAP PI 上的 WS 进行 Java SOAP 调用。
尝试卷曲,效果很好,得到了回应。 在 Java 上还有什么我想念的事情要做吗?
尝试使用代码我得到以下响应:
<?xml version='1.0'?>
<!-- see the documentation -->
<SOAP:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP:Body>
<SOAP:Fault>
<faultcode>SOAP:Server</faultcode>
<faultstring>Server Error</faultstring>
<detail>
<s:SystemError xmlns:s='http://sap.com/xi/WebService/xi2.0'>
<context>XIAdapter</context>
<code>ADAPTER.JAVA_EXCEPTION</code>
<text><![CDATA[
See log trace with id: n/a
]]></text>
</s:SystemError>
</detail>
</SOAP:Fault>
</SOAP:Body>
</SOAP:Envelope>
这是Java代码
String body = "body xml and validated ";
StringEntity stringEntity = new StringEntity(body, "UTF-8");
stringEntity.setChunked(true);
String soapAction = "ActionOut";
HttpPost httpPost = new HttpPost("http://x.x.x.x:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BSY_IBMMDM_T&receiverParty=&receiverService=&interface=ActionOut&interfaceNamespace=urn:yyyy.com:IBMMDM:AdobeForms");
UsernamePasswordCredentials creds = new UsernamePasswordCredentials("usr", "psw");
httpPost.addHeader(new BasicScheme().authenticate(creds, httpPost, null));
httpPost.setEntity(stringEntity);
httpPost.addHeader("Accept", "text/xml; charset=utf-8");
httpPost.addHeader("SOAPAction", soapAction);
// Execute and get the response.
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();