soapenv VS soap

Hello,

I am trying to send an XML SOAP request using cURL.  The request works, but it does not post any of the XML.  I began to use the following script to debug.

libxml_use_internal_errors(true);
$sxe = simplexml_load_string($soap_request);
print_r($sxe);
if (!$sxe) {
    echo "Failed loading XML\n";
    foreach(libxml_get_errors() as $error) {
        echo "\t", $error->message;
    }
}

Open in new window


If I use

$soap_request = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<soapenv: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/">
<soapenv:Body>
<RemittanceRequest>
<RequestType>BranchListRequest</RequestType>
<agent>BWS</agent>
<userid>wbsuser</userid>
<password>pass@wbs</password>
</RemittanceRequest>
</soapenv:Body>
</soapenv:Envelope>';

Open in new window


I receive no errors with the debugging code, but if I use

$soap_request = "<?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>    <AuthenticateByWebServiceCode xmlns=\"http://chsportal.primogen-solutions.co.uk/\">      <webServiceCode>xxx1</webServiceCode>    </AuthenticateByWebServiceCode>  </soap:Body></soap:Envelope>";

Open in new window


Everything fails..The only difference is soapenv VS soap.

I am trying to post this to

http://www.dfwebservice.net/DfcsRemittance.asmx?WSDL

using an ACTION of

http://dfwebservice.net/GetBranchListXML

any help getting this working would be greatly appreciated.

Thanks!
bradley525Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Slick812Commented:
greetings bradley525, , I am not sure how much help I can be for this, I will start by saying that any and ALL workable Soap server exchanges that I have done or know about NEVER use the php cURL( ), which is an HTTP web protocol sever exchange mechanism which is a ONE time request. The server SOAP uses a completely different server protocol, which is a connection , not a request,  you must use the php soap class as in -
    $client = new SoapClient("some.wsdl");
as outlined in the PHP manual -
    http://php.net/manual/en/soapclient.soapclient.php

however, it is my view that any programming language use of SOAP is NOT a simple thing, and in PHP as a SOAP client, , you have to set up ALL of your retrieved soap function parameters in arrays and use those arrays to get the function response from the SOAP function server.

Almost ALL web services that use the SOAP exchange, by necessity have Client code examples (in PHP, ASP, JSP) so developers can use their services as a Client. You need to go to your SOAP web service developers API information pages, and Copy and Paste their PHP SOAP client code examples, and hope you can see what they are doing.

If I have been unclear or not on topic, or you need more info, please ask questions
0
bradley525Author Commented:
Hello thank you for the response, unfortunately the SOAP web service developers do not have any php example code. All they provided was the sample XML request and response.

If I am using php and should not use cURL what should I use?

Thanks
0
Slick812Commented:
I am really not sure what to recommend to you now, As I said, the SOAP was created to do FUNCTIONS in a client computer, that communicate to another Server, and that distant server actually does the the "work" for that function, and then sends back a "result" to the Client side Function, to use the Result data to make the input parameters for another soap Function, and get back another result, for as many functions as needed to finish the work on the Client.

There are Different types of Soap connections, yours has an XML for the namespace and function definitions as a WSDL document here -
    http://www.dfwebservice.net/DfcsRemittance.asmx?WSDL
this is suppose to list all  remote "Class Objects" and their Methods and parameters.

and in the PHP code you might call it as -
    $client = new SoapClient( 'http://www.dfwebservice.net/DfcsRemittance.asmx?WSDL' );
    $paraArry = array ('agent' => 'BWS', 'userid' => 'ad5b2f21c0' 'password' => 'pass@wbs');
    $result = $client->RemittanceRequest($paraArry);

The above is a wild guess on my part for calling the $client->RemittanceRequest( );  method.

I really can NOT, get any relevant info from the WSDL at -
   'http://www.dfwebservice.net/DfcsRemittance.asmx?WSDL'
it uses an Object strategy with the  s:element   that I do not understand and have no time to research, as in this line-
      <s:element name="RemittanceRequestXML">

There is a PHP library called  nusoap.php  that has some SOAP RAD help in it, you can see a Page about it here -
    http://codewalkers.com/c/a/Miscellaneous/Using-SOAP-with-PHP/5/

the W3 Schools has a tutorial for SOAP, here's one page for it -
   http://www.w3schools.com/webservices/ws_soap_body.asp

as I said before, There are few developers that can look at the WSDL and see what the objects and methods and parameters will be in the client code, because of how the namespaces may or may not define complex types and other types. So, the Web Service has to have some way to show HOW to use their web service In a developer API listing. Sorry I can not just show you the correct code, If there is a developer API listing for this service , I will look at it an see if I can get anything.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

bradley525Author Commented:
I ended up using a windows server to get this to work..I had to write it in .NET...Nothing above seemed to work.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bradley525Author Commented:
The answers in this thread did not work I had to use .NET on a windows server to make SOAP work.
0
Donald DuckCommented:
The second line is incorrect. Here's a correct version:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.