Thread: PHP Web service

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0

    PHP Web service


    I am calling ASP.NET Web service using PHP 5.3 (SoapClient)
    Below is my WebService code.

    <soap:Body>
    <CreateCustomerOrder xmlns="(url)/">
    <co>
    <Auth_String>string</Auth_String>
    <Ext_SystemName>string</Ext_SystemName>
    <Ext_SystemReferenceNumber>string</Ext_SystemReferenceNumber>
    <Cust_Num>string</Cust_Num>
    <Cust_Seq>int</Cust_Seq>
    <Order_Date>dateTime</Order_Date>
    <Cust_PO>string</Cust_PO>
    <Whse>string</Whse>
    <Ship_Code>string</Ship_Code>
    <Taken_By>string</Taken_By>
    <Item>string</Item>
    <Cust_Item>string</Cust_Item>
    <Qty_Ordered>string</Qty_Ordered>
    <Due_Date>dateTime</Due_Date>
    <Prom_Date>dateTime</Prom_Date>
    <Price>string</Price>
    <Notes>string</Notes>
    </co>
    </CreateCustomerOrder>
    </soap:Body>

    Below is my PHP code:

    --------------------------------
    $wsdl="url"; //IDOServiceClient URL
    $client=new SoapClient($wsdl);
    $param=array("Auth_String"=>"test", "Ext_SystemName" => "TestingApp","Ext_SystemReferenceNumber" => "Reference Number","Cust_Num" => "1","Cust_Seq" => 10,"Order_Date" => $today,"Cust_PO" => "KKPO0016","Whse" => "MAIN","Ship_Code" => "UPS","Taken_By" => "KK","Item" => "FG-GE-0991","Cust_Item" => "KK Cust Item 908","Qty_Ordered" => "1","Due_Date" => $_ndate,"Prom_Date" => $_ndate,"Price" => "1.4","Notes" => "Testing notes");
    $res = $client->CreateCustomerOrder($param);
    print_r($res);
    -------------------------------
    My problem is parameters are not passing to web service.
    Can any one help me in this
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13
    Use PHP tags please, its hard to read.
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13
    It looks like you are doing it correctly, though there are a lot of parameters, so possibly passing something in incorrectly. Are you getting a response back? Or and error message?
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    I am getting response like below

    Result
    Array
    (
    [CreateCustomerOrderResult] => Array
    (
    [Status] => Error
    [Message] => Error occured while processing order
    [Request_ID] => 110
    )

    )

    Error, because of parameters are not passing to my webmethod (asp.net)
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13
    What happens if you pass nothing into the method, do you get the same error? I wonder if perhaps you are passing the parameters but something about the values is incorrect.
  10. #6
  11. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,119
    Rep Power
    9398
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    I changed my code like below and it's working fine...

    $soapClient = new SoapClient
    ('http://inhyvwsyte80300/IDOService/IDOServiceClient.asmx?WSDL'); //IDOServiceClient URL

    $today= date("Y-m-d");
    $next = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
    $_ndate = date("Y-m-d", $next);

    try
    {
    $search_query = new StdClass();
    $search_query->co = new StdClass();
    $search_query->co->Auth_String = "test";
    $search_query->co->Ext_SystemName = "TestingApp";
    $search_query->co->Ext_SystemReferenceNumber = "Reference Number";
    $search_query->co->Cust_Num = "1";
    $search_query->co->Cust_Seq = 10;
    $search_query->co->Order_Date = $today."T14:00:00";
    $search_query->co->Cust_PO = "KKPO0016";
    $search_query->co->Whse = "MAIN";
    $search_query->co->Ship_Code = "UPS";
    $search_query->co->Taken_By = "KK";
    $search_query->co->Item = "FG-GE-0991";
    $search_query->co->Cust_Item = "KK Cust Item 908";
    $search_query->co->Qty_Ordered = "1";
    $search_query->co->Due_Date = $_ndate."T14:00:00";
    $search_query->co->Prom_Date = $_ndate."T14:00:00";
    $search_query->co->Price = "1.4";
    $search_query->co->Notes = "Testing notes";
    $info = $soapClient -> CreateCustomerOrder($search_query);

    } catch (SoapFault $fault) {
    echo "ERROR" .$fault;
    }

IMN logo majestic logo threadwatch logo seochat tools logo