I solved it by generating php classes from the WSDL file.
For this I used the tool wsdl2phpgenerator.
After I passed the values as class objects, it worked.
如何在PHP中使用SOAP WebService的WSDL创建对象?
I am trying to call a Webservice with PHP. It works fine, but I got one function, which throws an NullReferenceException
. The function parameters are classes of the Webservice and defined in the WSDL file. In C# I can create instances of these classes, then I can pass these with the method. This works like expected, but in PHP I can't create these instances of the class like in C#.
I tried to create an instance of the class form the WSDL:
$myinstance1 = new SoapVar($content, SOAP_ENC_OBJECT, "Class1Name", $url_WSDL);
$myinstance2 = new SoapVar($content, SOAP_ENC_OBJECT, "Class2Name", $url_WSDL);
and then i tried to call the method with these parameters:
$result = $soapclient->GetMyObjects($myinstance1, $myinstance2);
I guess one problem is, that one of the classes is of type enumeration. The other class is a type of integer array. When I try to call my functions with these parameters I still recieve the NullReferenceException
error.
I think the problem is because of the enum type, which isn't converted correctly. Did I instanciate correctly? Does anyone have an idea, how to fix this problem?
- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答
1条回答
为你推荐
- PHP Soap Client:如何使用Derived类调用WebService作为参数?
- php
- web-services
- soap
- 2个回答
- SOAP WSDL - 如何在PHP中为特定方法创建工作调用
- wsdl
- php
- web-services
- soap
- 1个回答
- PHP中的Soap API集成:SoapClient错误
- wsdl
- xml
- php
- web-services
- soap
- 1个回答
- 在PHP中读取SOAP响应
- xml
- php
- soap
- 2个回答
- 使用SoapClient PHP无法连接
- wsdl
- php
- web-services
- soap
- 1个回答
- 如何在我的codeigniter soap服务器代码中声明多个函数?
- codeigniter
- php
- soap
- 1个回答
- PHP SoapServer(WSDL)如何将xml命名空间设置为项目而不是标题?
- wsdl
- binding
- namespaces
- php
- soap
- 1个回答
- 我可以在Opencart 2中使用PHP SoapClient运行Soap请求吗?
- wsdl
- php
- web-services
- soap
- 1个回答
- PHP - SOAP请求| XML / WSDL
- wsdl
- xml
- php
- 2个回答
- 如何使用php进行简单的SOAP调用?
- wsdl
- xml
- php
- web-services
- soap
- 2个回答
- 如何在PHP中使用SOAP WebService的WSDL创建对象?
- c#
- wsdl
- php
- web-services
- 1个回答
- 通过PHP Curl调用Soap WebService时超时
- curl
- xml
- php
- web-services
- soap
- 2个回答
- SOAP-ERROR:解析架构:无法从domain.com/WebService.svc?xsd=xsd0导入架构
- php
- soap
- 1个回答
- Wsdl方法不通过SoapClient调用,服务器是在YII中创建的
- wsdl
- php
- yii
- web-services
- 1个回答
- Codeigniter PHP - 解析SOAP(WSDL)结果
- codeigniter
- php
- json
- soap
- 1个回答
- PHP:SOAP webservice客户端到ASP.NET webservice服务器
- php
- 2个回答
- SoapClient中的Web服务URL和SOAP-ERROR:解析WSDL错误
- xml
- php
- web-services
- soap
- 1个回答
- 用于身份验证问题的PHP SOAP标头
- soapui
- authentication
- php
- soap
- 1个回答
- 如何在Yii中创建Web服务SOAP 1.2
- php
- yii
- web-services
- soap
- 1个回答
- 使用SOAP Webservice - Java VS PHP
- java
- php
- web-services
- soap
- 4个回答