donglong9745 2009-01-19 23:18
浏览 107
已采纳

使用PHP调用C#Web服务

I would like to call C# service with using PHP, anyone know how to do it? Thanks

  • 写回答

3条回答 默认 最新

  • dongmiyi8220 2009-01-19 23:22
    关注

    Create an SOAP XML document that matches up with the WSDL and send it via HTTP POST. See here for an example.

    You send this:

    POST /webservices/tempconvert.asmx HTTP/1.1
    Host: www.w3schools.com
    Content-Type: application/soap+xml; charset=utf-8
    Content-Length: length
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
      <soap12:Body>
        <CelsiusToFahrenheit xmlns="http://tempuri.org/">
          <Celsius>string</Celsius>
        </CelsiusToFahrenheit>
      </soap12:Body>
    </soap12:Envelope>
    

    And get this back:

    HTTP/1.1 200 OK
    Content-Type: application/soap+xml; charset=utf-8
    Content-Length: length
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
      <soap12:Body>
        <CelsiusToFahrenheitResponse xmlns="http://tempuri.org/">
          <CelsiusToFahrenheitResult>string</CelsiusToFahrenheitResult>
        </CelsiusToFahrenheitResponse>
      </soap12:Body>
    </soap12:Envelope>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥50 如何在不能联网影子模式下的电脑解决usb锁
  • ¥20 服务器redhat5.8网络问题
  • ¥15 如何利用c++ MFC绘制复杂网络多层图
  • ¥20 要做柴油机燃烧室优化 需要保持压缩比不变 请问怎么用AVL fire ESE软件里面的 compensation volume 来使用补偿体积来保持压缩比不变
  • ¥15 python螺旋图像
  • ¥15 算能的sail库的运用
  • ¥15 'Content-Type': 'application/x-www-form-urlencoded' 请教 这种post请求参数,该如何填写??重点是下面那个冒号啊
  • ¥15 找代写python里的jango设计在线书店
  • ¥15 请教如何关于Msg文件解析
  • ¥200 sqlite3数据库设置用户名和密码