V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
fengci
V2EX  ›  PHP

PHP - SOAP 写法求助

  •  
  •   fengci · 2018-10-17 23:39:39 +08:00 · 2765 次点击
    这是一个创建于 2010 天前的主题,其中的信息可能已经有所发展或是发生改变。

    求助用 php SAOP 类怎么实现下面的请求


    POST /CasinoGameService?singlewsdl HTTP/1.1
    Authorization: Basic [base64=username:password]
    Content-Type: text/xml; charset=utf-8
    SOAPAction: soapaction
    Host: wsdl
    Connection: close
    User-Agent: Paw/3.1.5 (Macintosh; OS X/10.14.0) GCDHTTPRequest
    Content-Length: 752
    
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="xxx">
    <soapenv:Header/>
    	<soapenv:Body>
    		<v1:RegisterUser>
    			<v1:UserInfo>
    				<v1:ExternalUserId>1234</v1:ExternalUserId>
    				<v1:Username>TestUser</v1:Username>
    				<v1:Nickname>TestUser123</v1:Nickname>
    				<v1:Currency>EUR</v1:Currency>
    				<v1:Country>SE</v1:Country>
    				<v1:Birthdate>1977-07-07</v1:Birthdate>
    				<v1:Registration>1978-08-08</v1:Registration>
    				<v1:BrandId>TestBrand</v1:BrandId>
    				<v1:Language>sv_SE</v1:Language>
    				<v1:IP>1253456</v1:IP>
    				<v1:Locked>false</v1:Locked>
    				<v1:Gender>m</v1:Gender>
    			</v1:UserInfo>
    		</v1:RegisterUser>
    	</soapenv:Body>
    </soapenv:Envelope>
    
    8 条回复    2023-05-14 06:57:46 +08:00
    kslr
        1
    kslr  
       2018-10-18 02:34:33 +08:00
    直接当成 POST 发过去
    beginor
        2
    beginor  
       2018-10-18 07:42:20 +08:00 via Android
    号称世界上最好的语言居然能没有 SOAP 相关轮子?
    focusheart
        3
    focusheart  
       2018-10-18 08:14:26 +08:00
    PHP 有 SoapClient,不用自己拼 xml。
    先问提供服务的人要服务的 wsdl,初始化 SoapClient 以后,就和调用本地函数基本一样,很容易使用的。
    GTim
        4
    GTim  
       2018-10-18 09:02:00 +08:00
    @beginor 当然有轮子,楼主可以看看 SoapClient
    fengci
        5
    fengci  
    OP
       2018-10-18 09:16:36 +08:00
    现在就是用 SoapClient 拼不出来
    fengci
        6
    fengci  
    OP
       2018-10-18 09:18:33 +08:00
    是自己不知道怎么用 SoapClient 去实现上面请求。我通过 curl 能实现
    NEETLEE
        7
    NEETLEE  
       2018-10-18 09:44:23 +08:00
    curl 实现+1
    louisxxx
        8
    louisxxx  
       341 天前
    挖坟,搜 Soap 我第一眼看到的你代码显示 CasinoGameService 好奇点开了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5260 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 07:44 · PVG 15:44 · LAX 00:44 · JFK 03:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.