How to pass Custom data types in calling document/literal wsdl from PHP?

View: New views
2 Messages — Rating Filter:   Alert me  

How to pass Custom data types in calling document/literal wsdl from PHP?

by sankar thatha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
     I'm calling coldfusion wsdl from php.I want to pass a complex/Custom typed data to the coldfusion wsdl. I have a method called batchOperation() in wsdl and it accepts custom type parameters. The paramater is some thing like this.

1)
An element represents--> (key,value) pair

I want to have Array of type element --> element[]

2) elementcollection represents --> (key,element[])
I want to have Array of type elementcollection --> elementcollection[]

3) An attribute represents --> (key,elementcollection[])


I have to send $attribute param from wsdl client. I want to construct attribute param, which I don't know?

I'm using nusoap for the same.

Attached is the wsdl.

Any help is appreciated. I'm a newbie to PHP and using SOAP in PHP.

Thnx
Sankaram.


      From Chandigarh to Chennai - find friends all over India. Go to http://in.promos.yahoo.com/groups/citygroups/
+ <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://services.cfide" xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://rpc.xml.coldfusion" />
+ <element name="batchOperation">
- <complexType>
- <sequence>
  <element name="serviceusername" type="xsd:string" />
  <element name="servicepassword" type="xsd:string" />
  <element name="sourcepath" type="xsd:string" />
  <element maxOccurs="unbounded" name="attributes" type="impl:Elementcollection" />
  </sequence>
  </complexType>
  </element>
+ <complexType name="Element">
- <sequence>
  <element name="key" nillable="true" type="xsd:string" />
  <element name="value" nillable="true" type="xsd:string" />
  </sequence>
  </complexType>
+ <complexType name="Elementcollection">
- <sequence>
  <element name="key" nillable="true" type="xsd:string" />
  <element name="value" nillable="true" type="tns1:ArrayOf_xsd_anyType" />
  </sequence>
  </complexType>
+ <element name="batchOperationResponse">
- <complexType>
- <sequence>
  <element name="batchOperationReturn" type="xsd:string" />
  </sequence>
  </complexType>
  </element>
  <element name="fault" type="tns1:CFCInvocationException" />
  </schema>
- <schema elementFormDefault="qualified" targetNamespace="http://rpc.xml.coldfusion" xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://services.cfide" />
+ <complexType name="ArrayOf_xsd_anyType">
- <sequence>
  <element maxOccurs="unbounded" minOccurs="0" name="item" type="impl:Element" />
  </sequence>
  </complexType>
+ <complexType name="CFCInvocationException">
  <sequence />
  </complexType>
  </schema>
  </wsdl:types>
+ <wsdl:message name="CFCInvocationException">
  <wsdl:part element="impl:fault" name="fault" />
  </wsdl:message>
+ <wsdl:message name="batchOperationResponse">
  <wsdl:part element="impl:batchOperationResponse" name="parameters" />
  </wsdl:message>
+ <wsdl:message name="batchOperationRequest">
  <wsdl:part element="impl:batchOperation" name="parameters" />
  </wsdl:message>
+ <wsdl:portType name="SampleImage">
- <wsdl:operation name="batchOperation">
  <wsdl:input message="impl:batchOperationRequest" name="batchOperationRequest" />
  <wsdl:output message="impl:batchOperationResponse" name="batchOperationResponse" />
  <wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException" />
  </wsdl:operation>
  </wsdl:portType>
+ <wsdl:binding name="SampleImage.cfcSoapBinding" type="impl:SampleImage">
  <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="batchOperation">
  <wsdlsoap:operation soapAction="" />
- <wsdl:input name="batchOperationRequest">
  <wsdlsoap:body use="literal" />
  </wsdl:input>
- <wsdl:output name="batchOperationResponse">
  <wsdlsoap:body use="literal" />
  </wsdl:output>
- <wsdl:fault name="CFCInvocationException">
  <wsdlsoap:fault name="CFCInvocationException" use="literal" />
  </wsdl:fault>
  </wsdl:operation>
  </wsdl:binding>
+ <wsdl:service name="SampleImageService">
- <wsdl:port binding="impl:SampleImage.cfcSoapBinding" name="SampleImage.cfc">
  <wsdlsoap:address location="http://localhost/CFIDE/services/SampleImage.cfc" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: How to pass Custom data types in calling document/literal wsdl from PHP?

by John-597 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am slightly confused by what exactly you are trying to pass into the
batchOperation() call.  For me, passing comples/custom types as
parameters result in creating an associative array, but for cleaner code
you can try something like the following:

Consider a function like this:

retrieveLibraryBook( BookTitleObject title )

and the BookTitleObject has a constructor like the following:

BookTitleObject( String Title )

You can call the original function with the following code (I am more
familiar with PHP5's soap functions, so this should work, but has the
possibility of not, if that is the case, create an associative array):

$argument->BookTitleObject->title = "Ender's Game";
$client->call( 'retrieveLibraryBook', $argument );


or with the PHP5 built in soap objects in non-WSDL mode (definitely
should work):

$argument->BookTitleObject->title = "Ender's Game";
$client->retrieveLibraryBook( $argument );


sankar thatha wrote:

> Hi,
>      I'm calling coldfusion wsdl from php.I want to pass a complex/Custom typed data to the coldfusion wsdl. I have a method called batchOperation() in wsdl and it accepts custom type parameters. The paramater is some thing like this.
>
> 1)
> An element represents--> (key,value) pair
>
> I want to have Array of type element --> element[]
>
> 2) elementcollection represents --> (key,element[])
> I want to have Array of type elementcollection --> elementcollection[]
>
> 3) An attribute represents --> (key,elementcollection[])
>
>
> I have to send $attribute param from wsdl client. I want to construct attribute param, which I don't know?
>
> I'm using nusoap for the same.
>
> Attached is the wsdl.
>
> Any help is appreciated. I'm a newbie to PHP and using SOAP in PHP.
>
> Thnx
> Sankaram.
>
>
>       From Chandigarh to Chennai - find friends all over India. Go to http://in.promos.yahoo.com/groups/citygroups/
>

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

LightInTheBox - Buy quality products at wholesale price!