Holger,
Thank you for the reply - as it turns out I was not passing an associative
array in my method call. After reviewing the WSDL a bit more closely I
discovered that my arguments had names such as "arg0", "arg1", etc. I found
that the following works for me:
$result = $client->testString(array("arg0"=>"test"));
The following does NOT work for me (although it would be nice if it did):
$result = $client->testString("test");
Again, thanks for the reply and I'll look into those other configuration
options.
Regards,
Kaleb
|------------>
| From: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|"Holger Stolzenberg" <[EMAIL PROTECTED]>
|
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|<[email protected]>
|
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|08/24/2007 04:48 AM
|
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject: |
|------------>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|AW: Passing method parameters using PHP SoapClient failing
|
>--------------------------------------------------------------------------------------------------------------------------------------------------|
The PHP call to your WS method seems to be false. You have to provide a
associative array for the WS method params. Following code shows how we do
it:
// the wsdl URL of your service to test
$serviceWsdl =
'http://127.0.0.1:8080/EEX_Shop_Backend/ws-api/CustomerService?wsdl';
// the parmeters to initialize the client with
$serviceParams = array( 'trace' => 1, 'soap_version' => SOAP_1_1, 'style'
=> SOAP_DOCUMENT, 'use' => SOAP_LITERAL );
// create the SOAP client
$client = new SoapClient( $serviceWsdl, $serviceParams );
// method call
$res = $client->getCustomerById( array( 'auth' => "passwd", 'customerId' =>
2 ) );
var_dump( $res );
-----Ursprüngliche Nachricht-----
Von: Kaleb Walton [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 23. August 2007 14:55
An: [email protected]
Betreff: Passing method parameters using PHP SoapClient failing
As a requirement for our customers I'm trying to get SOAP communication
going using PHPs SoapClient object. Calling methods with no parameters
works fine (I get results) but when I pass in parameters I get a "Fault
occurred while processing" error message returned which I assume is coming
somewhere within the CXF framework.
The PHP code is pretty simple:
$client = new SoapClient('http://localhost:8080/services/Person?wsdl');
$client->testString('abc'); <-- This line returns an error message of
'Fault occurred while processing'
Service object:
@WebService(endpointInterface = "a.b.c.webservices.PersonService")
public class PersonServiceImpl implements PersonService {
public String testString(String id) {
System.out.println("PersonServiceImpl: testString: "+id);
return id;
}
}
Config:
<bean id="personServiceImpl"
class="a.b.c.webservices.PersonServiceImpl"/>
<jaxws:endpoint id="personServer" implementor="#personServiceImpl"
address="/Person" />
<bean id="personService" class="net.iss.mss.webservices.PersonService"
factory-bean="clientFactory" factory-method="create" />
<bean id="clientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="a.b.c.webservices.PersonService"/>
<property name="address"
value="http://localhost:8080/services/Person"/>
</bean>
Also, it looks like CXF uses Java's Logging implementation, however, I
cannot seem to get it to log anywhere. Does anyone have any quick pointers
on how to get that going?
Regards,
Kaleb Walton