Lasagna Cat
Lasagna Cat

Reputation: 397

Trying to get PHP to post response from WSDL call

I'm having trouble getting my form to do an ID lookup and parse the response back from the WSDL call via PHP. Using the BLZ unique ID of 10000000, the name that corresponds with that BLZ unique ID is Bundesbank.

Here is the HTML portion:

<html>
<head>
<body>
<form name="myForm" id="frm1" action="idresponse.php" method="POST">
    <input name="userID" placeholder="Enter ID">
    <input type="Submit"></b>
</form>
<b></b>    
<input name="responseID" id="frm2" placeholder="ID response from WSDL call"></input>
</body>
</head>
</html>

Here is the PHP portion:

<?php
    $soapClient = new SoapClient("http://www.thomas-bayer.com/axis2/services/BLZService?wsdl",array( "trace" => 1));
    $blz_param = array (
        'blz' => "10000000",
        );
$info = $soapClient->__call("CheckSomething", array($service_param));
echo "Request :\n".htmlspecialchars($soapClient->__getLastRequest()) ."\n";
?>

Use Case:

-User enters 10000000 into BLZ number field box.
-Code takes BLZ number and does a request and lookup from WSDL url.
-Response from WSDL url sends name of banking institution from BLZ number 10000000.
-From BLZ number 10000000, bank name should be Bundesbank.

The WSDL url:

http://www.thomas-bayer.com/axis2/services/BLZService?wsdl

INPUT WSDL (mapped out from SoapUI):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:blz="http://thomas-bayer.com/blz/">
   <soapenv:Header/>
   <soapenv:Body>
      <blz:getBank>
         <blz:blz>10000000</blz:blz>
      </blz:getBank>
   </soapenv:Body>
</soapenv:Envelope>

OUTPUT WSDL (mapped out from SoapUI):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns1:getBankResponse xmlns:ns1="http://thomas-bayer.com/blz/">
         <ns1:details>
            <ns1:bezeichnung>Bundesbank</ns1:bezeichnung>
            <ns1:bic>MARKDEF1100</ns1:bic>
            <ns1:ort>Berlin</ns1:ort>
            <ns1:plz>10591</ns1:plz>
         </ns1:details>
      </ns1:getBankResponse>
   </soapenv:Body>
</soapenv:Envelope>

Upvotes: 1

Views: 594

Answers (1)

Kris Peeling
Kris Peeling

Reputation: 1025

There is no 'CheckSomething' method in that WSDL you provided. However there is a 'getBank' method you should be calling instead. Example:

 try {
 $soapClient = new SoapClient("http://www.thomas-bayer.com/axis2/services/BLZService?wsdl",array('trace' => 1,'exceptions' => true));
 $blz_param = array (
   'blz' => "10000000",
 );
 $info = $soapClient->getBank($blz_param);
 var_dump($info);
} catch (Exception $e) {
  var_dump($e ->getMessage());
}

Upvotes: 1

Related Questions