SAP PI web service throws ADAPTER.JAVA_EXCEPTION

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

When using curl, I got a successful response. However, when running the provided Java 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>

Do I need to do something else in Java to make the call work?

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

I’m attempting to make a Java SOAP call to a WS on SAP PI. I’ve tried with curl and got a successful response, however when running the provided Java code, I received an error response. Is there something else I need to do in Java to make the call successful?

Based on the error response, it seems that there is an issue with the server. You may want to check the server logs to see if there are any errors or exceptions that can help identify the issue. It is also possible that there is an issue with the request being sent from the Java code. You can try debugging the code and comparing the request being sent from curl to the one being sent from Java to see if there are any differences.