Ironically, that bit of code that were talking about regarding
instantiating the object was borrowed from the CF documentation
regarding handling complex types in CF web services.

Actually there is no documentation that indicates that you can pass a
CFC as a web service argument but you can return it as a web service
response.  The WSDL is formed correctly to accept it as an argument so
that's why I was led to believe that you could pass in the object as an
argument.

How CF handles structures and arrays of structures for web services is
not very standard, in terms of interoperability.  Yes, it can be done,
but if another system or platform were to access the service, it would
require some additional hand-holding on that system to create a request
that CF would accept and be able to manipulate, which may not be
possible in some cases. 

My goal is to come up with a WSDL that defines the structure of the
request so that the arguments are self-explanatory and are not embedded
inside of an XML argument.

Thanks for your help and suggestions, Mike!


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ferris, Mike
Sent: Monday, March 19, 2007 3:53 PM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: RE: [DFW CFUG] Problem Invoking CF webservice with an
arrayofcomplextype

Rick,

As a matter of best practice, if using a .cfc to create an object, I
would specifically instantiate the object with an init() method. Again,
as best practice, although ColdFusion dynamically type casts, the WSDL
specifies double, so I would use a numeric rather than string
representation of the value.

A colleague suggested that the problem may be that you cannot pass a CF
object when invoking a webservice. Could you create objOrderLine as a
structure and send an array of structures instead? Or, maybe as an XML
document?

Mike 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Monday, March 19, 2007 3:34 PM
To: [EMAIL PROTECTED]
Subject: RE: [DFW CFUG] Problem Invoking CF webservice with an array
ofcomplextype

Thanks for the reply, Mike.

I don't know if the instantiation is required.  I've used this code
before but not in cfscript syntax.  I might try it as CFML instead of
using cfscript.

Regarding the double data type, ColdFusion actually converts the CF type
of "numeric" to a double.  When I invoke the submitOrder service in my
CF page, CF automatically converts my argument value to the appropriate
data type as defined in the WSDL.

If there's something I've stated above that isn't right, please let me
know.

Rick...



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ferris, Mike
Sent: Monday, March 19, 2007 2:58 PM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: RE: [DFW CFUG] Problem Invoking CF webservice with an array
ofcomplex type

Rick,

I may be missing something here.  You create the "objOrderLine"
component, but don't invoke or instantiate an init() or any other
method. You start assigning values to it as if it is a structure.

Also, you define the Price to be double, but send a string - "19.99".

Hope this helps.

Mike

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Monday, March 19, 2007 11:17 AM
To: [EMAIL PROTECTED]
Subject: [DFW CFUG] Problem Invoking CF webservice with an array of
complex type

I'm having trouble invoking a CF web service that has an argument that
is an array of a CFC.

I *think* I'm passing in the correct parameters and it appears that the
WSDL is being generated properly, but for some reason it's not liking
the complex type argument that I'm passing in.

Here is an example of the WSDL:

<element name="submitOrder">
    <complexType>
     <sequence>
      <element name="customerNumber" type="xsd:string"/>
      <element maxOccurs="unbounded" name="orderLine"
type="impl:OrderLineInput"/>
     </sequence>
    </complexType>
</element>

<complexType name="OrderLineInput">
    <sequence>
     <element name="Quantity" nillable="true" type="xsd:double"/>
     <element name="Product" nillable="true" type="xsd:string"/>
     <element name="Price" nillable="true" type="xsd:double"/>
     <element name="Discount" nillable="true" type="xsd:string"/>
    </sequence>
</complexType>

This is my code to invoke the web service and pass in the arguments:

<CFSET arrOrderLine = ArrayNew(1)>
<CFOBJECT component="OrderLineInput" name="objOrderLine">

<cfscript>
objOrderLine.Quantity = 1;
objOrderLine.Product = "XYZ";
objOrderLine.Price = "19.99";
objOrderLine.Discount = "0";

ArrayAppend(arrOrderLine, objOrderLine);

ws = CreateObject("webservice",
"http://localhost/components/Order.cfc?wsdl";);

result = ws.submitOrder(customerNumber="ABC123",
orderLine=arrOrderLine);
</cfscript>

I'm getting this error:
Web service operation "submitOrder" with parameters
[EMAIL PROTECTED], ....could not be found.

This usually indicates that I missed a parameter or it didn't like the
parameters I passed in.

If anybody can help me clue in on what I'm doing wrong, I'd greatly
appreciate it.

Thanks,

Rick Law
Lead Web Systems Engineer, MIS
The Thomson Corporation
801 Cherry St., Suite 1300
Fort Worth, TX 76102
p: 817-252-4091
e: [EMAIL PROTECTED]
ppc.thomson.com
 
 

_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.instantspot.com/
  www.teksystems.com/

CONFIDENTIALITY NOTICE: The information contained in this e-mail and
attached document(s) may contain confidential information that is
intended only for the addressee(s). If you are not the intended
recipient, you are hereby advised that any disclosure, copying,
distribution or the taking of any action in reliance upon the
information is prohibited. If you have received this e-mail in error,
please immediately notify the sender and delete it from your system.

_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.instantspot.com/
  www.teksystems.com/

_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.instantspot.com/
  www.teksystems.com/

CONFIDENTIALITY NOTICE: The information contained in this e-mail and
attached document(s) may contain confidential information that is
intended only for the addressee(s). If you are not the intended
recipient, you are hereby advised that any disclosure, copying,
distribution or the taking of any action in reliance upon the
information is prohibited. If you have received this e-mail in error,
please immediately notify the sender and delete it from your system.

_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.instantspot.com/
  www.teksystems.com/

_______________________________________________
Reply to DFWCFUG:
  [email protected]
Subscribe/Unsubscribe:
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
    http://www.mail-archive.com/list%40list.dfwcfug.org/
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
  www.instantspot.com/
  www.teksystems.com/

Reply via email to