gpt4 book ai didi

java - 调用 SAP PI Web 服务抛出 ADAPTER.JAVA_EXCEPTION

转载 作者:行者123 更新时间:2023-12-05 07:15:11 38 4
gpt4 key购买 nike

我正在对 SAP PI 上的 WS 进行 Java SOAP 调用。

尝试了 curl,效果很好,得到了回应。有什么我想念的关于 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();

最佳答案

你需要验证一下,原始数据中有没有特殊字符。

关于java - 调用 SAP PI Web 服务抛出 ADAPTER.JAVA_EXCEPTION,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59668553/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com