6 Replies Latest reply on Aug 6, 2008 12:49 AM by Leigh Mills

    CF web services driving me mad

    Leigh Mills
      Hi all,

      I am attempting to consume some asp web services using CF8 and it is driving me beserk. I can connect when I am expecting nothing than multiple string or integer fields but as soon as I hit a service which is expecting a complex structure all I get is error messages back saying that web service operation with {field names} cannot be found.

      Can anyone give me an example of how to build the complex structure as I have now read so many blogs that it is going around in circles.

      Big thanks

      Leigh

      ------

      if anyone is interested the wsdl bit is pasted below.

      - <s:element name="AddPurchaseOrderExternal">
      - <s:complexType>
      - <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="Title" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Forename" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Surname" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Mobile" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DeliveryAddress" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DeliveryTown" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DeliveryCounty" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DeliveryPostcode" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DeliveryCountry" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DeliveryNotes" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="BillingAddress" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="BillingTown" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="BillingCounty" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="BillingPostcode" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="BillingCountry" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="OrderNotes" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="PurchaseItems" type="tns:ArrayOfPurchaseItemInfoExternal" />
      <s:element minOccurs="1" maxOccurs="1" name="TaxAmount" type="s:decimal" />
      <s:element minOccurs="1" maxOccurs="1" name="DeliveryAmount" type="s:decimal" />
      <s:element minOccurs="1" maxOccurs="1" name="DonationAmount" type="s:decimal" />
      <s:element minOccurs="1" maxOccurs="1" name="TotalAmount" type="s:decimal" />
      <s:element minOccurs="0" maxOccurs="1" name="MarketingInfo" type="s:string" />
      <s:element minOccurs="1" maxOccurs="1" name="NoFutureMailings" type="s:boolean" />
      <s:element minOccurs="1" maxOccurs="1" name="OptInEmail" type="s:boolean" />
      <s:element minOccurs="1" maxOccurs="1" name="EmailPDF" type="s:boolean" />
      <s:element minOccurs="1" maxOccurs="1" name="IsTest" type="s:boolean" />
      </s:sequence>
      </s:complexType>
      </s:element>
      - <s:complexType name="ArrayOfPurchaseItemInfoExternal">
      - <s:sequence>
      <s:element minOccurs="0" maxOccurs="unbounded" name="PurchaseItemInfoExternal" type="tns:PurchaseItemInfoExternal" />
      </s:sequence>
      </s:complexType>
      - <s:complexType name="PurchaseItemInfoExternal">
      - <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="ProductName" type="s:string" />
      <s:element minOccurs="1" maxOccurs="1" name="Quantity" type="s:int" />
      <s:element minOccurs="1" maxOccurs="1" name="ItemPrice" type="s:decimal" />
      </s:sequence>
      </s:complexType>
      - <s:element name="AddPurchaseOrderExternalResponse">
      - <s:complexType>
      - <s:sequence>
      <s:element minOccurs="1" maxOccurs="1" name="AddPurchaseOrderExternalResult" type="s:int" />
      </s:sequence>
      </s:complexType>
      </s:element>
        • 1. Re: CF web services driving me mad
          JR "Bob" Dobbs-qSBHQ2 Level 3
          Can you post your invocation code?
          • 2. Re: CF web services driving me mad
            Leigh Mills Level 1
            Hi, here is the code I am using the invoke the servivce.

            Cheers
            Leigh

            <cfscript>
            stUser = structNew();
            stUser.PurhaseItemInfoExternal.ProductName = "1001";
            stUser.PurhaseItemInfoExternal.Quantity = 1;
            stUser.PurhaseItemInfoExternal.ItemPrice = 23.00;
            </cfscript>

            <cfdump var="#stuser#">
            <cfinvoke
            webservice=" http://81.91.243.3/Services.asmx?wsdl"
            method="AddPurchaseOrderExternal"
            username="BrookeBTB"
            password="Br00k3"
            returnvariable="RetVar"
            timeout="10">

            <cfinvokeargument name="Title" value="Mr">
            <cfinvokeargument name="Forename" value="Leigh">
            <cfinvokeargument name="Surname" value="Millard">
            <cfinvokeargument name="Email" value="leighm@btbmf.co.uk">
            <cfinvokeargument name="Phone" value="123123123123">
            <cfinvokeargument name="Mobile" value="123123123123">
            <cfinvokeargument name="DeliveryAddress" value="1 main street">
            <cfinvokeargument name="DeliveryTown" value="bedford">
            <cfinvokeargument name="DeliveryCounty" value="bedfordshire">
            <cfinvokeargument name="DeliveryPostcode" value="mk43 8tg">
            <cfinvokeargument name="DeliveryCountry" value="united kingdom">
            <cfinvokeargument name="DeliveryNotes" value="these are the notes.">
            <cfinvokeargument name="BillingAddress" value="1 main street">
            <cfinvokeargument name="BillingTown" value="bedford">
            <cfinvokeargument name="BillingCounty" value="bedfordshire">
            <cfinvokeargument name="BillingPostcode" value="mk43 8tg">
            <cfinvokeargument name="OrderNotes" value="these are notes">
            <cfinvokeargument name="PurchaseItems" value="#Stuser#">
            <cfinvokeargument name="TotalAmount" value="20.00">
            <cfinvokeargument name="TaxAmount" value="10.00">
            <cfinvokeargument name="DeliveryAmount" value="5.00">
            <cfinvokeargument name="DonationAmount" value="5.00">
            <cfinvokeargument name="MarketingInfo" value="this is marketing info">
            <cfinvokeargument name="NoFutureMailings" value="true">
            <cfinvokeargument name="OptInEmail" value="true">
            <cfinvokeargument name="EmailPDF" value="true">
            <cfinvokeargument name="IsTest" value="true">

            </cfinvoke>
            • 3. Re: CF web services driving me mad
              Dan Bracuk Level 5
              It might be signifcant that the wsdl says it wants an array and you are sending a structure.
              • 4. Re: CF web services driving me mad
                Leigh Mills Level 1
                but all of the documentation i have read to date insists that it must be a structure as this is what allows CF to create the named elements correctly when processing??
                • 5. Re: CF web services driving me mad
                  JR "Bob" Dobbs-qSBHQ2 Level 3
                  Can you post the entire WSDL file?
                  • 6. Re: CF web services driving me mad
                    Leigh Mills Level 1
                    hi,

                    http://81.91.243.3/Services.asmx?wsdl
                    username = BrookeBTB
                    password= Br00k3

                    Cheers
                    Leigh