Web services: Getting a C# program talking to a PHP server

Discussion in 'Webmastering & Programming' started by carl67lp, Sep 24, 2004.

  1. carl67lp

    carl67lp [H]ardness Supreme

    Messages:
    4,559
    Joined:
    Oct 17, 2001
    I've tried NuSOAP, I've tried the SOAP package built in to PHP, I've tried things in between--and still nothing seems to work.

    I add the Web reference in VS.NET just fine. The closest I can seem to get is this error:

    "Server found request content type to be 'text/html; charset=ISO-8859-1', but expected 'text/xml'."

    I've poked around Google but can't seem to find anything that would match my situation. The most similar talks about SOAP::Lite, but that's not what I'm using. (In this case, I'm using NuSOAP.)

    Is there something I'm missing? Is it simply impossible for a C# client (specifically, that bastardly PocketPC) to talk SOAP to a PHP server?
     
  2. carl67lp

    carl67lp [H]ardness Supreme

    Messages:
    4,559
    Joined:
    Oct 17, 2001
  3. Sgarissta

    Sgarissta Limp Gawd

    Messages:
    168
    Joined:
    Jul 16, 2003
    The text/html issue is an extremly nagging problem. It deals with the fact that your webservice (if you followed most of the PHP docs out there) is encoded as RPC/Encoded. While .NET will add a reference and build a client class, your PHP server will probably hose on it. Take a look at http://www.pocketsoap.com/tcptrace/pt.aspx for a tool that will help you better see the response your PHP is sending.

    While this will help you better debug the issue it will not solve it. The only solution to this I found was to manually write the WSDL document following the Document/Literal specification. I'd try and explain more but it's, well, strange. The only real examples of this that I could find out there, were in the PEAR::SOAP_Interop package. I'd REALLY recommend downloading it, and reading the WSDL examples for Document/Literal based webservices.

    [edit] I also recommend that you make sure your variables are returned as data types defined in your WSDL, it makes the Doc/Lit translation from RPC/Enc much easier. (I don't know the NuSOAP pacakge so I can't explain much further)
     
  4. carl67lp

    carl67lp [H]ardness Supreme

    Messages:
    4,559
    Joined:
    Oct 17, 2001
    There's that document/literal bit you were talking about. :)

    I have the next two days off of work, so I'm going to try my best to not think about this, but knowing me and how I approach a challenge, I'll probably work on it some this weekend.
     
  5. carl67lp

    carl67lp [H]ardness Supreme

    Messages:
    4,559
    Joined:
    Oct 17, 2001
    I've done a Google for the document/literal stuff, but I haven't been able to come up with many hits. I looked into PocketSOAP as was suggested in another thread, but apparently this won't work since it's COM-based and that won't do on a Pocket PC (as I'm shooting for).

    Here I was all excited by PocketSOAP and it looks like I'm back to square one.

    Anyone have good links for doc/lit SOAP?