2 Replies Latest reply on Jun 10, 2008 10:02 AM by Mikkhait

    Consuming .NET webservice

    Mikkhait
      I have a webservice that I have to push data to. I am not a .NET guys and cannot translate this to ColdFusion very well. Here is an example of C# code provided. Attached on the bottom.

      Now...
      I've created following...
      <cfset ws = Createobject("webservice","https://url")>
      <cfscript>
      sOrder.CustomerId = 1;
      sOrder.OrderStatus = "Incomplete";
      sOrder.OrderDate = DateFormat(now(), "yyyy-mm-dd") & "T" & TimeFormat(now(), "HH:mm:ss") & "Z";
      sOrder.CurrencyCode = "USD";
      sOrder.WarehouseID = "1";
      sOrder.ShipMethodId = "2";
      sOrder.PriceType = 1;
      sOrder.FirstName = "misha";
      sOrder.LastName = "misha";
      sOrder.Company = "a";
      sOrder.Address1 = "address1";
      sOrder.Address2 = "address2";
      sOrder.City = "sj";
      sOrder.State = "CA";
      sOrder.Zip = "33333";
      sOrder.Country = "US";
      sOrder.County = "a";
      sOrder.Email = "test@test.com";
      sOrder.Phone = "555-555-5555";
      sOrder.Notes = "a";
      sOrder.details = ArrayNew(1);
      sOrder.details[1] = StructNew();
      sOrder.details[1].ItemCode = "code1";
      sOrder.details[1].Quantity = 1;
      sOrder.details[2] = StructNew();
      sOrder.details[2].ItemCode = "code2";
      sOrder.details[2].Quantity = 1;
      ws.CreateOrder(sOrder);
      </cfscript>

      This code throws an error
      Web service operation CreateOrder with parameters {parameters here} cannot be found.

      What am I missing?
        • 1. Re: Consuming .NET webservice
          Dan Bracuk Level 5
          Whenever I get that specific error it's because I failed to send one of the arguments. And, for the record, if you make a cfc a ws, 100% of the arguments are mandatory, irrespective of what your cfargument tags say.
          • 2. Re: Consuming .NET webservice
            Mikkhait Level 1
            I am sure I'm passing everything to what ws is requiring. Here is a part of wsdl
            <s:extension base="tns:BaseCalculateOrderRequest">

            <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="CustomerID" type="s:int"/>
            <s:element minOccurs="1" maxOccurs="1" name="Frequency" type="tns:FrequencyType"/>
            <s:element minOccurs="1" maxOccurs="1" name="StartDate" type="s:dateTime"/>
            <s:element minOccurs="0" maxOccurs="1" name="CurrencyCode" type="s:string"/>
            <s:element minOccurs="1" maxOccurs="1" name="WarehouseID" type="s:int"/>
            <s:element minOccurs="1" maxOccurs="1" name="ShipMethodID" type="s:int"/>
            <s:element minOccurs="1" maxOccurs="1" name="PriceType" type="s:int"/>
            <s:element minOccurs="1" maxOccurs="1" name="PaymentType" type="tns:AutoOrderPaymentType"/>
            <s:element minOccurs="0" maxOccurs="1" name="FirstName" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="LastName" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="Company" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="Address1" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="Address2" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="State" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="Zip" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="County" 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="Notes" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="Details" type="tns:ArrayOfOrderDetailRequest"/>
            </s:sequence>
            </s:extension>