Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using complex objects from web services

Status
Not open for further replies.

SpotsyRWH

Programmer
Dec 2, 2005
11
US
What I have is a web service that from what I can tell returns a complex object. The object type is defined in the web service WSDL.

My question is how can I access, or better yet use that complex object in cold fusion (7). If I try and call any of the functions, or access any of the attributes of the object cold fusion gives me the error I expected it to, "Element undefined in variable test".

(BTW this particular web service was written in C# and is maintained/created by an outside vendor, so I have no control over it)

The data returned is not in an XML format (as I would expect) doing an XML parse on the variable causes cold fusion to throw an error that it can't be parsed.

See below for the cfdump of the variable:

object of com.metafile.mvdoc.ArrayOfShortcut

Methods hashCode (returns int)
equals (returns boolean)
getSerializer (returns interface org.apache.axis.encoding.Serializer)
getDeserializer (returns interface org.apache.axis.encoding.Deserializer)
getTypeDesc (returns org.apache.axis.description.TypeDesc)
getShortcut (returns com.metafile.mvdoc.Shortcut)
getShortcut (returns [Lcom.metafile.mvdoc.Shortcut;)
setShortcut (returns void)
setShortcut (returns void)
getClass (returns java.lang.Class)
wait (returns void)
wait (returns void)
wait (returns void)
notify (returns void)
notifyAll (returns void)
toString (returns java.lang.String)

f I do a cfoutput of the variable test I get the following:

com.metafile.mvdoc.ArrayOfShortcut@9d35128

My guess is that I must create this "ArrayOfShortcut" object in cold fusion. As well as all the otherones needed. Is there a way around this?

I found the following page that talks about creating java code from the WSDL, however I personally think that it is making what should be a simple task, very complex.


Anyone have any suggestions?
 
I tried the methods mentioned on that page (in fact it was the first resource I went to)

However it does not work.

Here is some of my code:

<cfinvoke webservice="metafile" method="GetShortcuts" returnvariable="Test">
<cfinvokeargument name="UserName" value="Secret">
</cfinvoke>

I then attempt to set a structure with some of the information returned, however I always get errors that test.whatever is undefined. Is this because it is a complex object that has complex objects inside it?

Here is some of the WSDL incase I am missing something:

Under types:
<xsd:complexType name="Shortcut">
- <xsd:sequence>
<xsd:element name="Description" nillable="true" type="xsd:string" />
<xsd:element name="DocumentClass" nillable="true" type="xsd:string" />
<xsd:element name="Id" nillable="true" type="xsd:string" />
<xsd:element name="Name" nillable="true" type="xsd:string" />
<xsd:element name="Type" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="ArrayOfShortcut">
- <xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Shortcut" nillable="true" type="tns:Shortcut" />
</xsd:sequence>
</xsd:complexType>

Under <portType name="MVDocServer"> :

<operation name="GetShortcuts">
<wsdl:documentation xmlns:wsdl=" Documentation</wsdl:documentation>
<input message="tns:MVDocServer_GetShortcuts__Request_Soap" />
<output message="tns:MVDocServer_GetShortcuts_Response_Soap" />
<fault name="GeneralException2" message="tns:GeneralException2" />
<fault name="InvalidArgumentException2" message="tns:InvalidArgumentException2" />
<fault name="UnknownUserNameException1" message="tns:UnknownUserNameException1" />
</operation>

Under <binding name="MVDocServer" type="tns:MVDocServer">:

<operation name="GetShortcuts">
<wsdl:documentation xmlns:wsdl=" Documentation</wsdl:documentation>
<soap:eek:peration soapAction=" style="document" />
- <input>
<soap:body parts="parameters" use="literal" />
</input>
- <output>
<soap:body parts="parameters" use="literal" />
</output>
- <fault name="GeneralException2">
<soap:fault name="GeneralException2" use="literal" />
</fault>
- <fault name="InvalidArgumentException2">
<soap:fault name="InvalidArgumentException2" use="literal" />
</fault>
- <fault name="UnknownUserNameException1">
<soap:fault name="UnknownUserNameException1" use="literal" />
</fault>
</operation>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top