Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
118 views
in Technique[技术] by (71.8m points)

php - How to use SOAP with WSDL?

I am trying to pass a request to a SOAP service and need help with the code. Inside my php.ini file for XAMPP, SOAP is enabled. And I double checked that using echo phpinfo();.

I have tried dozens of url extension endings, but this following url is what I am told should work, and is successful in Postman as well as pasted into the browser. Please use code to answer my question along with explanations.

Here is what I have:

<?php 

 try {
     $soapclient = new SoapClient("https://blah.com/webservice/ratequote/xml.aspx"); 

     $param=array('UserID'=>'blah', 'Password'=>'blah');
     $response = $soapclient->CreateResponse($param);

     var_dump($response);

     $array = json_decode(json_encode($response), true);

     print_r($array);

 }catch(Exception $e) {
     echo $e->getMessage();
 }


?>

In addition, I have also tried using the following endpoints: $soapclient = new SoapClient("http://blah.com/webservice/ratequote/xml.aspx?wsdl");

$soapclient = new SoapClient("http://blah.com/webservice/ratequote/xml.aspx?wsdl=1");

One the errors that I get in the same order sequence I list the 3 URLs above:

SOAP-ERROR: Parsing WSDL: Couldn't find in 'https://blah.com/webservice/ratequote/xml.aspx'

SOAP-ERROR: Parsing WSDL: Couldn't find in 'https://blah.com/webservice/ratequote/xml.aspx?wsdl'

SOAP-ERROR: Parsing WSDL: Couldn't find in 'https://blah.com/webservice/ratequote/xml.aspx?wsdl=1'

Please also note that I have tried using http instead of https for all 3 urls as well. That should cover just about everything I have seen and tried.

question from:https://stackoverflow.com/questions/65927440/how-to-use-soap-with-wsdl

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...