I'm very new to pear soap and would appreciate help calling a function on the java web service in order to get this working correctly.
The proxy code generation is as follows, (WSDL file at the bottom of this
email)
class WebService_LDAPAuthGen_LDAPAuthGenSEIPort extends SOAP_Client {
function WebService_LDAPAuthGen_LDAPAuthGenSEIPort(
$path='http://solldap2:8080/LDAPAuthGen/LDAPAuthGen')
{
$this->SOAP_Client($path, 0); }
function &authenticate() {
$result = $this->call('authenticate', $v = null,
array('namespace' =>'urn:LDAPAuthGen/wsdl',
'soapaction' => '',
'style' => 'document',
'use' => 'literal'));
return $result;
}
}
So I try to call this via pear soap client e.g.
require 'SOAP/Client.php';
$param = array('String_1' => 'foo', 'String_2' => 'bar', 'String_3' => 'foo1', 'String_4' => 'bar2');
$wsdl = new
SOAP_WSDL('https://japps.manukau.ac.nz:8181/LDAPAuthGen/LDAPAuthGen?WSDL');
$WLproxy = $wsdl->getProxy();
//echo ($wsdl->generateProxyCode());
//$WLproxy->setOpt('trace', 1);
$client_code = $WLproxy->authenticate($param); if (PEAR::isError($client_code)) { echo 'error<br>'; echo 'message: <pre>'.$client_code->getMessage().'</pre><br>';
echo 'user info: <pre>'.$client_code->getUserInfo().'</pre><br>';
echo 'get wire: <pre>'.$WLproxy->__get_wire().'</pre><br>';
} else {
echo 'no error<br>';
echo "<pre>\n";
print_r($client_code);
echo "</pre>";
}
However I get this error;
Error
message:
JAXRPC.TIE.04: Internal Server Error (JAXRPCTIE01: caught exception while handling request: java.lang.ClassCastException:
com.sun.xml.messaging.saaj.soap.impl.TextImpl)
user info:
get wire:
OUTGOING:
POST /LDAPAuthGen/LDAPAuthGen HTTP/1.0
User-Agent: PEAR-SOAP 0.8.0RC4-devel
Host: solldap2
Content-Type: text/xml; charset=UTF-8
Content-Length: 404
SOAPAction: ""
INCOMING
HTTP/1.1 500 Server Error
Server: Sun-Java-System/Application-Server
Date: Tue, 04 Apr 2006 03:24:42 GMT
Content-type: text/xml;charset=utf-8
X-powered-by: Servlet/2.4
Soapaction: ""
Connection: close
env:Server
JAXRPC.TIE.04: Internal Server Error (JAXRPCTIE01: caught exception while handling request: java.lang.ClassCastException:
com.sun.xml.messaging.saaj.soap.impl.TextImpl)
WDSL file as follows
<?xml version="1.0" encoding="UTF-8" ?>
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="urn:LDAPAuthGen/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns2="urn:LDAPAuthGen/types" name="LDAPAuthGen"
targetNamespace="urn:LDAPAuthGen/wsdl">
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:LDAPAuthGen/types"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:LDAPAuthGen/types">
- <complexType name="authenticate">
- <sequence>
<element name="String_1" type="string" nillable="true" />
<element name="String_2" type="string" nillable="true" />
<element name="String_3" type="string" nillable="true" />
<element name="String_4" type="string" nillable="true" />
</sequence>
</complexType>
- <complexType name="authenticateResponse">
- <sequence>
<element name="result" type="string" nillable="true" />
</sequence>
</complexType>
<element name="authenticate" type="tns:authenticate" />
<element name="authenticateResponse" type="tns:authenticateResponse" />
</schema>
</types>
- <message name="LDAPAuthGenSEI_authenticate">
<part name="parameters" element="ns2:authenticate" />
</message>
- <message name="LDAPAuthGenSEI_authenticateResponse">
<part name="result" element="ns2:authenticateResponse" />
</message>
- <portType name="LDAPAuthGenSEI">
- <operation name="authenticate">
<input message="tns:LDAPAuthGenSEI_authenticate" />
<output message="tns:LDAPAuthGenSEI_authenticateResponse" />
</operation>
</portType>
- <binding name="LDAPAuthGenSEIBinding" type="tns:LDAPAuthGenSEI">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
- <operation name="authenticate">
<soap:operation soapAction="" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="LDAPAuthGen">
- <port name="LDAPAuthGenSEIPort" binding="tns:LDAPAuthGenSEIBinding">
<soap:address location="http://solldap2:8080/LDAPAuthGen/LDAPAuthGen"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
</port>
</service>
</definitions>
Cheers
Todd.