user3817361
user3817361

Reputation: 1

SOAP Service: I have a sample request file XML but getting confused about the format

I'm working on integrating to a remote service running Apache Axis. I have been given a sample request file that looks like the following

<?xml version="1.0" encoding="UTF-8"?>
<request xmlns="http://api.somedomain.com/openSession" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="openSession.xsd">
    <session key="xabc123092"/>
    <user name="admin" password="secret"/>
</request>

I know SOAP requires "envelope and body" such that the request conforms with

<?xml version="1.0" encoding="UTF-8"?>
<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:Body>
</soapenv:Envelope>

Now I'm confused about the sample request file given to me. I have tried to craft the following SOAP request with some SOAPAction in the request header but to no avail

<?xml version="1.0" encoding="UTF-8"?>
<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:openSession>
         <session key="xabc123092"/>
         <user name="admin" password="secret"/>
      </soapenv:openSession>
    </soapenv:Body>
</soapenv:Envelope>

The above gives the following

<?xml version="1.0" encoding="UTF-8"?>
<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>soapenv:Server.userException</faultcode>
            <faultstring>org.xml.sax.SAXException: operation description is missing parameter description!</faultstring>
            <detail>
                <ns1:hostname 
                    xmlns:ns1="http://xml.apache.org/axis/">api.somedomain.com
                </ns1:hostname>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

Can someone tell me what I'm missing here?

Upvotes: 0

Views: 924

Answers (1)

Rao
Rao

Reputation: 21379

Not sure if you are still facing this problem. It was missing request element along with the namespace in the soap request. Please try below:

<?xml version="1.0" encoding="UTF-8"?>
<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>
        <request xmlns="http://api.somedomain.com/openSession" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="openSession.xsd">
            <session key="xabc123092"/>
            <user name="admin" password="secret"/>
        </request>
    </soapenv:Body>
</soapenv:Envelope>

Upvotes: 1

Related Questions