2

I'm using PHP SoapClient to consume a webservice..

Everything is working fine when service parameters are simple and something like $client->GetProductById(array('productId' => 'ID')); does the trick...

but one of the services that I need to access to, requires more complex parameters.. I've used SoapUI to test the webservice, and with SoapUI I can easily make it work..

The problem is that I can't make it work with PHP SoapClient, I simply can't find a way to represent all those parameters..

The Soap message that is sent to the server is this (copied from SoapUI)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:slps="http://www.microsoft.com/slps/">
<soapenv:Header/>
<soapenv:Body>
    <slps:GetLicensesByFilter>
         <slps:filter>
            <slps:ExcludeCommercial>false</slps:ExcludeCommercial>
            <slps:ExcludeTrial>false</slps:ExcludeTrial>
            <slps:IssueDateRange>
           <slps:End>2011-12-31T00:00:00.000Z</slps:End><slps:Start>2011-11-01T00:00:00.000Z</slps:Start>
            </slps:IssueDateRange>
            <slps:ProductId>1275b704-7622-c2xx-922e-76186497f744</slps:ProductId>
            <slps:SkuId>A35138F43-0119-0719-802a-B48CCE6229A4</slps:SkuId>
         </slps:filter>
     <slps:retrievalOptions>LicenseInfo</slps:retrievalOptions><slps:pageIndex>0</slps:pageIndex>
  </slps:GetLicensesByFilter>
</soapenv:Body>
</soapenv:Envelope>
2
  • I do the same solution as the author found out. Commented Dec 5, 2011 at 18:13
  • @BarCa: Please add your solution as an answer below (see how I did that exemplary) and then accept your answer as the answer (Yes that is how it works and it's totally accepted). Thank you! Commented Jan 2, 2013 at 18:35

2 Answers 2

1

I think the way to go here is to generate the relevant php classes according to your *.wsdl file. This can be done using tools like wsdl2php --> http://www.urdalen.no/wsdl2php/.

After that, you can use the generated Service class to do your webservice calls or you can just get the relevant classes and use the "classmap" option when creating an instance of your Soap Client.

Sign up to request clarification or add additional context in comments.

Comments

0

By the orignal author of the question, moved from the question into an answer:

edit: Finally I got it ;)

Probably not the best approach but it works, I've followed a tip that a user left in PHP forums..basicaly I had to create some classes to represent the parameters structure, and then when I had to use the 'classmap' option of SoapClient to map that WSDL type into my PHP classes...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.