There is an error in XML document (1, 472). RRS feed

  • Question

  • Hi,

    I have created web service in php having one method which returns array.

    I am consuming this web service in asp.net. 

    The above exception is thrown while try to call method from c#. But if I changed return type of method in webservice to the string then its working fine. I need to return string array from php webservice. 

    My PHP service page contains the following code:


     * wsGetJourney method
     * @param string $who name of the person we'll say hello to
     * @return string $helloText the hello  string
    function wsGetJourney($id) {
            return array('101'=>'Maharashtra','102'=>'Karnataka');
            return array('101'=>'Tamilnadu','102'=>'Goa');


    $namespace = "http://tempuri.org";

    // create a new soap server
    $server = new soap_server();
    // configure our WSDL
    // set our namespace
    $server->wsdl->schemaTargetNamespace = $namespace;
    // register our WebMethod
                    // method name:
                    // parameter list:
                    // return value(s):
                    // namespace:
                    // soapaction: (use default)
                    // style: rpc or document
                    // use: encoded or literal
                    // description: documentation for the method
                    'A simple Hello World web method');

    // Get our posted data if the service is being consumed
    // otherwise leave this data blank.                
                    ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';

    // pass our posted data (or nothing) to the soap service                    



    And I am consuming webservice in asp.net by adding service reference(Add web reference).

    Please let me know if I am doing something wrong. 



    Wednesday, September 12, 2012 11:36 PM

All replies

  • We're not so expert in that subject here. I'd ask again at http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/threads

    http://www.alanjmcf.me.uk/ Please follow-up in the newsgroup. If I help, please vote and/or mark the question answered. Available for contract programming.

    Friday, September 14, 2012 10:33 AM
  • A webpage can't return an object unless it is in a tagged object.  An array string must have the strings serperated by a delimiter.  Then use a split method to make them an array object.

    first I would look at the string that is being returned when the code works.  See if there is a delimiter between the strings.  Then let the code use string and the use the spilt method to create an arrray of string in your service.


    Friday, September 14, 2012 10:34 AM