?
Solved

soapenv VS soap

Posted on 2014-09-06
6
Medium Priority
?
1,944 Views
Last Modified: 2016-10-25
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!
0
Comment
Question by:bradley525
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:Slick812
ID: 40307804
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
 

Author Comment

by:bradley525
ID: 40307813
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
 
LVL 35

Expert Comment

by:Slick812
ID: 40308873
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
bradley525 earned 0 total points
ID: 40362720
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
 

Author Closing Comment

by:bradley525
ID: 40372512
The answers in this thread did not work I had to use .NET on a windows server to make SOAP work.
0
 

Expert Comment

by:Donald Duck
ID: 41858630
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question