Search code examples
javaeclipsesoapwsdlwsdl2java

Why SOAP request returns RESPONSE correctly in Eclipse WSE but not when using Postman?


I have a WSDL application generated Skeleton, I use the Web Service Explorer to test one Invokation and it works fine in Eclipse WSE but when I use POSTMAN I get a response error saying:

<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
            <faultstring>no SOAPAction header!</faultstring>

This is the request code:

SOAP REQUEST:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://biller.com/onlinebilling" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <q0:sendPmtNotification>
      <PmtNotificationRequest>
        <RequestId>3454</RequestId>
        <InqDate>2018-11-08T20:35:44.626Z</InqDate>
        <PaidInvoices>
          <InvoiceId>123</InvoiceId>
          <PaidValue>2333</PaidValue>
          <BankSrc>wqewqe</BankSrc>
          <BankAuthCŪode>123</BankAuthCode>
          <ValuesDetail>
            <Description>wqeweqweqwe</Description>
            <Value>123</Value>
          </ValuesDetail>
        </PaidInvoices>
      </PmtNotificationRequest>
    </q0:sendPmtNotification>
  </soapenv:Body>
</soapenv:Envelope>

SOAP RESPONSE

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <sendPmtNotificationResponse xmlns="http://biller.com/onlinebilling">
      <PmtNotificationResponse xmlns="">
        <Status>OK</Status>
        <RequestId>1002</RequestId>
        <Message>MESSAGE_RESPONSE</Message>
        <PartnerAuthCode>partnerAUTH_CODE</PartnerAuthCode>
      </PmtNotificationResponse>
    </sendPmtNotificationResponse>
  </soapenv:Body>
</soapenv:Envelope>

SOAP RESPONSE IN POSTMAN

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
            <faultstring>no SOAPAction header!</faultstring>
            <detail>
                <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">BATTLES_WINNER</ns2:hostname>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

screenshot of postman

enter image description here


Solution

  • In Soap 1.1, the SOAPAction HTTP Header is required to be sent by the client. This allows firewalls and servers to identify a SOAP request without having to interrogate the full body of the request. It can be used for intelligent routing or in general, better manage web service requests.

    The value can be arbitrary, and if a specific value is required, it will be in the WSDL; usually, it's a URI. Section 6.1 of the SOAP 1.1 spec lightly describes the behavior.

    In Postman, you add the header via the Headers tap on the request section. If a specific value is required for an operation, check the WSDL. Based on the comments a blank header is acceptable in your case.

    Since WSE is a dedicated web services testing tool, I'm guessing it's being kind and automagically adding the value. Postman is a more general HTTP testing tool, so it's probably being less kind, which might explain the behavioral differences.