We help IT Professionals succeed at work.
Get Started

PHP, WSDL, SOAP related problem

2,405 Views
Last Modified: 2013-11-19
I am not sure why it is not recognizing the encoding style, any help will be greatly appreciated.  The error message is listed below

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Unknown encodingStyle 'http://www.w3.org/2001/12/soap-encoding' in C:\wamp\www\temp\soap-client.php:2 Stack trace: #0 C:\wamp\www\temp\soap-client.php(2): SoapClient->SoapClient('c:/wamp/www/tem...') #1 {main} thrown in C:\wamp\www\temp\soap-client.php on line 2

Attached are the codes
Soap-server.php
 
<?php 
function getCatalogEntry($catalogId) { 
  if($catalogId=='catalog1')
 
return "<HTML>
 <HEAD>
  <TITLE>Catalog</TITLE>
 </HEAD
 <BODY>
<p> </p>
 <table border>
<tr><th>CatalogId</th>
<th>Journal</th><th>Section
</th><th>Edition</th><th>
Title</th><th>Author</th>
</tr><tr><td>catalog1</td>
<td>IBM developerWorks</td><td>
XML</td><td>October 2005</td>
<td>JAXP validation</td>
<td>Brett McLaughlin</td></tr>
</table>
</BODY>
</HTML>";
 
elseif ($catalogId='catalog2')
 
return "<HTML>
 <HEAD>
  <TITLE>Catalog</TITLE>
 </HEAD
 <BODY>
<p> </p>
 <table border>
 
<tr><th>CatalogId</th><th>
Journal</th><th>Section</th>
<th>Edition</th><th>Title
</th><th>Author
</th></tr><tr><td>catalog1
</td><td>IBM developerWorks</td>
<td>XML</td><td>July 2006</td>
<td>The Java XPath API
</td><td>Elliotte Harold</td>
</tr>
</table>
</BODY>
</HTML>";
} 
 
ini_set("soap.wsdl_cache_enabled", "0"); 
$server = new SoapServer("catalog.wsdl"); 
$server->addFunction("getCatalogEntry"); 
$server->handle(); 
 
?>
 
soap-clinet.php
 
<?php  
  $client = new SoapClient("c:/wamp/www/temp/catalog.wsdl");
  $catalogId='catalog1';
  $response = $client->getCatalogEntry($catalogId);
  echo $response;
?>
 
catalog.wsdl
 
<?xml version ='1.0' encoding='UTF-8' ?> 
<definitions name='Catalog' 
  targetNamespace='http://example.org/catalog' 
  xmlns:tns=' http://example.org/catalog ' 
  xmlns:soap12='http://schemas.xmlsoap.org/wsdl/soap12/' 
  xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
  xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
  xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
  xmlns='http://schemas.xmlsoap.org/wsdl/'> 
 
<message name='getCatalogRequest'> 
  <part name='catalogId' type='xsd:string'/> 
</message> 
<message name='getCatalogResponse'> 
  <part name='Result' type='xsd:string'/> 
</message> 
 
<portType name='CatalogPortType'> 
  <operation name='getCatalogEntry'> 
    <input message='tns:getCatalogRequest'/> 
    <output message='tns:getCatalogResponse'/> 
  </operation> 
</portType> 
 
<binding name='CatalogBinding' type=
'tns:CatalogPortType'> 
  <soap12:binding style='rpc' 
    transport='http://schemas.xmlsoap.org/soap/http'
  /> 
  <operation name='getCatalogEntry'> 
    <soap12:operation soapAction='urn:localhost-catalog#
    getCatalogEntry'/> 
    <input> 
      <soap12:body use='encoded' namespace='urn:localhost-catalog' 
			
			encodingStyle="http://www.w3.org/2001/12/soap-encoding"/> 
    </input> 
    <output> 
      <soap12:body use='encoded' namespace=
   'urn:localhost-catalog' 
        encodingStyle='http://schemas.xmlsoap.org/soap/
    encoding/'/> 
    </output> 
  </operation> 
</binding> 
 
<service name='CatalogService'> 
  <port name='CatalogPort' binding=
  'CatalogBinding'> 
    <soap12:address location='http://localhost/temp/soap-server.php'/> 
  </port> 
</service>
</definitions>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE