I have to send a XML file as parameter for a web service using SOAP. Any help with how can I do it?
And.. What's the XML Schema (XSD file)?
The XML has to be passed as a string which will be encoded in order to be encapsulated in the XML SOAP Request.
In any case, I strongly advise you to use a WSDL to PHP generator such as the PackageGenerator project which eases the request construction and the response handling,
Related
I have a soap server and i want to make a login request.
https://github.com/haruntuncay/soapClient In this repo, you can see generated php code from "WSDL2PHP". How can i do a proper login request.I could not get it working.You can see what i have tried in final 20 lines of server.php.
TIA
You should definitively use a WSDL to php generator as I think you're not sending the request as it should be.
So using a WSDL to php generator, you will know exactly how to send the request and its associated parameters using PHP objects and the native PHP SoapClient class without having to deal directly with it.
I advise you to try the PackageGenerator project.
I used SOAP UI to test my implementation and it works there. However, I do not know how to do this without SOAP UI in a php environment.
I currently have php code pulling data from the MySQL database and outputting well-formed XML, but I do not know how to send this XML output to the web service to be processed.
Any help would be great.
Thanks
You don't have to create your own SOAP XML. There is a perfectly fine SOAP extension available, where you can create a SoapClient using the services WSDL-file.
http://ch1.php.net/soap
If it is really only about sending the data, use curl.
Configuration example: How can I send SOAP XML via Curl and PHP?
I´m trying to do an integration between my own PHP application, and other external software which is 'waiting for' (listening) SOAP messages. But the key question on my situation is that this software which is listening for SOAP messages only accepts RAW contents and has no method which could be called, or Wsdl to be used.
Yes I know... it´s quite strange because with SOAP you usually should send a method request with some parameters, but in this case the only that I have is a URL where I should send with SOAP message that should contain only an string (formatted in a special way which is not a problem), and then this server will return to my PHP application another SOAP message that will contain a string. And that´s all.
Seems that in my case I can not use a PHP SOAP library because I have no method (or function) to call; the only thing that I have is a URL and a string that I should pass like a parameter. I´ve been thinking of using PHP sockets to create a basic SOAP message to that 'strange soap server', but I have no clue about how to do it, or how I woule create with PHP a way to keep my application waiting for the answer comming from that external server.
Thank you so much for your help in advance.
You might be best of by just making the WSDL on your own. It isn't the most trivial thing to do, but it is well documented so you should be able to figure it out.
THere is no need to get the WSDL from the service you're sinding your requests to (it is rather better to have WSDL locally in some cases), so you just initialize the default SOAP client in PHP with that local WSDL, and off you go.
I'm setting up a SOAP service using the PHP SOAP server and client library.
I've coded some structured data types into my wsdl file with some heavy restrictions.
Do you know of functionality in the PHP SOAP library or of a 3rd party library which will check the actual parameters in the the server against the definitions of the WSDL file? Or do I have to code all my parameter checking explicitly into my SOAP server class, even though it is already coded in the WSDL?
In PHP 5.2 the SOAP server does not validate against the WSDL as described here http://bugs.php.net/bug.php?id=45966
I'm not sure about 5.3 though.
My website is written in PHP. How should I write the PHP code to send a SOAP request to another server and parse the response.
The link below is the server who can accept the request.
http://gisdata.usgs.gov/XMLWebServices2/Elevation_Service.asmx?op=getElevation
Thanks.
You have options.
If it's available on your server, there's a native SoapClient extension for php. You could use that.
Or, you might prefer the Zend_Soap library, which is part of the Zend Framework, but can easily be used independently.
There venerable nuSoap library is an old standby.