?

Log in

No account? Create an account
coldfusion_mx
..::.:.:. ..: .........: .:::..:::.

January 2010
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

VillaiN [userpic]

The issue I have encountered with is that while writing the web service on c# one of the parameters of the method that should be used is a array of structure. The issue is actually that the client written on ColdFusion doesn’t see my method and while launching it crashes it and displays the error. "Web service operation "test" with parameters {t2={{A={[{PRICE={12},NAME={Myname}}]}}}} could not be found. "

My question is what is the right way to declare the variables in the web service? (It is not advisable to change the client as I’m writing the web service for the client and not vice verse.)


Client:
< cfscript>
  a = ArrayNew(1);
  t=structNew();
  t.price = 12;
  t.name  = "Myname";
  a[1] = t;
  t2=structNew();
  t2.a = a;
< /cfscript>
< cfinvoke webservice="http://localhost:2851/test/Service21.asmx?WSDL" method="test" returnvariable="wsResult">
< cfinvokeargument name="t2" value=#t2#/>
< /cfinvoke>
< cfoutput>#wsResult#< /cfoutput>

WebService:

[SoapTypeAttribute(Namespace = "http://dts")]
public class postback_response
{
    public double crl_id;
    public double resp_code;
    public string resp_message;
}
[SoapTypeAttribute(Namespace = "http://dts")]
public struct test_c2
{
    public test_c[] a;
}
[SoapTypeAttribute(Namespace = "http://dts")]
public class test_c
{
    public double price;
    public string name;
}

    [WebMethod(), SoapRpcMethod(Use = System.Web.Services.Description.SoapBindingUse.Literal)]
    public postback_response test(test_c2 t2)
    {

        postback_response response = new postback_response();
        response.crl_id = 1;
        response.resp_code = 0;
        response.resp_message = "test";
        return response;
    }

Current Music: Vinnickaya Alena - Izmuchennoe serdce (Gorchitza Remix)
Comments

It seems like it indeed cannot find method test. If the datatype would be incorrect, there would be a different error.

When I’m sending just a structure "t" and receiving it on .NET’s side as test_c, then it's start working. But I have to deliver and get the array structure "t".