locked
http 405 error calling asmx web service with php RRS feed

  • Question

  • User-565527305 posted

    getting a http 405 error when calling an asmx web service using php.  have configured iis to allow GET, POST on the server.  any assistance is greatly appreciated.

    here's the recieving code for the web service:

    private string[][] BuildParameters(string myparam)
    {
        string[][] parameters = new string[0][];
        parameters[0] = new string[] { "@myparam", myparam, "3" };
        return parameters;
    }
    
    [WebMethod]
    public object GetScalarValue(string title)
    {
        dataAccess = new DA();
        dataAccess.ConnectionString = GetConnectionString();
        dataAccess.ProcedureName = "ExecStoredProcedure";
        dataAccess.ProcedureParameters = BuildParameters(myparam);
        return dataAccess.GetScalarValue();
    }

    here's the calling php code:

    <?php
    $soap_client = new SoapClient(null, array(
        'location' => 'http://TestWebservice.test.web.service',
        'uri' => 'http://tempuri.org/',
    ));
    try {
        $param = array(
            'myparam' => '000150',
        );
        $info = $soap_client->__soapCall('GetScalarValue’ ', array($param));
        print ‘<pre>’ . print_r($info, TRUE) . ‘</pre>’;
    } catch (SoapFault $fault) {
        echo $soap_client->__getLastRequestHeaders();
        $error = 1;
        print('Sorry, service returned the following ERROR: ' . $fault->faultcode . '-' . $fault->faultstring);
    }
    ?>
    



    Monday, February 25, 2013 11:02 AM

Answers

  • User-565527305 posted

    figured this out.  unchecked IE internet options - advanced setting 'show friendly http error messages' and got a more descriptive error...array out of bounds.

    fix was to change:

    string[][] parameters = new string[0][];

    to:

    string[][] parameters = new string[1][];
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 25, 2013 3:06 PM

All replies

  • User-565527305 posted

    figured this out.  unchecked IE internet options - advanced setting 'show friendly http error messages' and got a more descriptive error...array out of bounds.

    fix was to change:

    string[][] parameters = new string[0][];

    to:

    string[][] parameters = new string[1][];
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 25, 2013 3:06 PM
  • User-1000095884 posted

    Hi,

    Glad to hear that you have resolved the issue and thanks for sharing the solution here, it will be very beneficial for other community members who have similar questions. Thanks.

    Best Regards.

    Tuesday, February 26, 2013 4:58 AM