简体   繁体   中英

Callling SAP PI web-service throws ADAPTER.JAVA_EXCEPTION

I'm making a Java SOAP call to a WS on SAP PI.

Tried with a curl and it worked well, getting a response. Is there something to do more on Java that I miss?

Trying with the code i got the following response:

<?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>

Here's the Java code

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();

您需要验证原始数据中是否有任何特殊字符。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM