soapwsdl

Auth in sharepoint wsdl


I used soapUI tool for fetch soap request from my dummy wsdl server

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetListCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
  </soap:Body>
</soap:Envelope>

and take response. But when I try to take request from my real server I cant auth. In soap envelope I added header

  <soap:Header>
    <AUTHHEADER>
      <USERNAME>Administrator</USERNAME>
      <PASSWORD>Password</PASSWORD>
    </AUTHHEADER>
  </soap:Header>

but something wrong. Login and pass is right, I checked.

UPD1

I send query like this

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:AUTHHEADER>
      <soap:USERNAME>Administrator</soap:USERNAME>
      <soap:PASSWORD>Password</soap:PASSWORD>
    </soap:AUTHHEADER>
  <soap:Body>
    <GetListCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
  </soap:Body>
</soap:Envelope>

and I have

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>Server was unable to read request. ---> Request format is invalid: Missing required soap:Body element.</faultstring>
         <detail/>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

from real server.


Solution

  • Try to change your query like this:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header xmlns:ns0="http://schemas.microsoft.com/sharepoint/soap/">
    <ns0:AUTHHEADER>
      <ns0:USERNAME>Administrator</ns0:USERNAME>
      <ns0:PASSWORD>Password</ns0:PASSWORD>
    </ns0:AUTHHEADER>
    </soap:Header>
    <soap:Body>
       <GetListCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
    </soap:Body>
    </soap:Envelope>
    

    EDIT1: repair example to add another ns to authheader. Be honest: I don't know, if there is defined an authheader elements in ns of http://schemas.microsoft.com/sharepoint/soap, but I pretend it, because it can be different for every WSDL interface. I know, that there is WSSE standard, but it is coded in XML request differently.