CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1

    Ways to return XML from function in SoapServer function?

    Hi,

    I'm struggling with a webservice at the moment. I can invoke the service from multiple clients and get a response. The problem is the server seems to be returning the XML that I want it to return but it is stripping the content of xml that contains attributes so:

    Code:
    <Element attr="123">123</Element>
    Becomes:

    Code:
    <Element attr="123" />
    SOAP UI can connect to the WSDL and generate a dummy output and it suggests the output should be as expected but when the web service itself returns to SOAP UI content is stripped.

    I use PHP Pear Unserializer to read the XML in and it seems to put everything nicely in an array. I fear the array cannot be parsed properly by the server code.

    Are there any alternatives to returning an array from Unserializer for returning XML from the webservice?
    Last edited by goatslayer; March 16th, 2011 at 03:11 PM.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Ways to return XML from function in SoapServer function?

    I'm having trouble understanding where exactly the PHP problem is here. Sounds to me like you have a web service problem, not PHP.

    Plus, if the data is in an array, you wouldn't ever parse an array, you would just read the values.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3

    Re: Ways to return XML from function in SoapServer function?

    My PHP web service based on SoapServer returns XML to my PHP web service client based on SoapClient.

    Unfortunately the XML seems to be stripped of the contents of the element as described above.

    The response from the web service is the PHP array returned from Unserialize().

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Ways to return XML from function in SoapServer function?

    So you have PHP communicating to PHP through SOAP? Why are you using SOAP for in-language communication?

    Perhaps if you could layout your project in more detail...
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5

    Re: Ways to return XML from function in SoapServer function?

    Peej, I think your thinking about this too deeply.

    The php soap client is just a test client. Like I mentioned, I have the same problem when I retrieve the XML via Soap UI and another Java client. The XML sent to either of these clients has its content stripped from the elements and the attributes still in tact.

    The question is simply, instead of returning the response from unserialize as my soap server response what other approaches can i take to return XML from my soap server.

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Ways to return XML from function in SoapServer function?

    Have you gone through all the options? Seems like there's lots of control over ther return...

    http://pear.php.net/manual/en/packag...er.options.php
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7

    Re: Ways to return XML from function in SoapServer function?

    Yeah, I've done that. When I do a var_dump all the data is nicely encoded in the array but it doesn't seem to affect the output from the server.

    I think I'll see in the morning if loading the data using simplexml and letting the service return that will do the trick i think.

  8. #8

    Re: Ways to return XML from function in SoapServer function?

    In the end I created the web service from scratch. There is still some work to do to make it more conformant with standard web services but it's about there.

    The solution was essentially take full control of the service and when it came to return the XML I wanted I loaded it into a new DOMDocument() and then returned the XML that way.

    Thanks for the help peej.

    I guess the solution hasn't been found from the original question's point of view so if anyone has more to add to this thread at a later date that might be useful to all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured