标签: wsdl

SOAP 错误:编码:对象没有“first_name”属性

当我尝试调用用 PHP Web 服务编写的 Web 方法时,我在 .NET 项目中收到“SOAP-ERROR: Encoding: object has not 'first_name' property”错误消息。Web 方法返回一个 PHP 数组$result_data。我已经在 WSDL 中为数组返回的字段添加了元素。由于我是 PHP 新手,无法获得返回数组的结构。该数组似乎是两个级别的。

$result_data => array(array( "first_name"
"last_name")

array( "first_name"
"last_name")

array( "first_name"
"last_name")
)
Run Code Online (Sandbox Code Playgroud)

这是我的 WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:tns="http://10.20.1.161/api/soap/"
    xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    targetNamespace="http://10.20.1.161/api/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:types>
<s:schema targetNamespace="http://10.20.1.161/api/soap/" elementFormDefault="qualified">
    <s:import namespace="http://microsoft.com/wsdl/types/"/>

    <s:element name="getUsers">
        <s:complexType>
            <s:sequence>
                <s:element minOccurs="1" maxOccurs="1" name="message" type="s:string"/>
            </s:sequence>
        </s:complexType>
    </s:element>

    <s:element name="getUsersResponse">
        <s:complexType>
            <s:sequence>
                <s:element name="getUsersArray" type="tns:getUsersArray"/>
            </s:sequence>
        </s:complexType>
    </s:element>

    <s:complexType …
Run Code Online (Sandbox Code Playgroud)

.net php soap wsdl c#-4.0

2
推荐指数
1
解决办法
5609
查看次数

如何从 xsd 创建 wsdl

我想使用 3 个 xsd 文件创建一个 wsdl。你怎么看?

我在命令提示符下试过这个:

wsdl.exe /language:cs /parameters: c:\myService\Contract\HeaderData.xsd c:\myService\Contract\MyData.xsd c:\myService\Contract\Messages.xsd /out: MyWsdl.wsdl
Run Code Online (Sandbox Code Playgroud)

我怎么了?

c# xsd wsdl

2
推荐指数
1
解决办法
9614
查看次数

使用有问题的 wsdl 的服务 - 意外元素异常

我必须使用有问题的 wsdl 服务(无法更改)。起初我不得不自定义映射,因为生成的类在 java.x 包中。现在我生成了香草客户端并尝试使用它:

    Services handle = new Services(new URL("http://172.16.1.2:8080/axis2/services/x?wsdl"));
    ServicesPortType service = handle
            .getServicesHttpSoap11Endpoint();


    x.y.ws.datamodels.xsd.ObjectFactory obj = new x.y.ws.datamodels.xsd.ObjectFactory();

    IPInterfaceInfo sourceIPInterface = obj.createIPInterfaceInfo();
            service.getInformation(sourceIPInterface);
Run Code Online (Sandbox Code Playgroud)

无论如何,这段代码实际上什么都不做并且只包含空值会引发异常:

WARNING: Interceptor for {http://workflowprocessor.ws.y.x}Services# {http://workflowprocessor.ws.y.x}getBandwidthInformation has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"http://datamodels.ws.y.x/xsd", local:"infoString"). Expected elements are <{http://logging.util.java/xsd}resourceBundleName>,<{http://logging.util.java/xsd}resourceBundle>,<{http://logging.util.java/xsd}parent>,<{http://logging.util.java/xsd}useParentHandlers>,<{http://logging.util.java/xsd}filter>,<{http://logging.util.java/xsd}handlers>,<{http://logging.util.java/xsd}level>,<{http://logging.util.java/xsd}name> 
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:822)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:643)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:157)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1635)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1502)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1410)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:650)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366) …
Run Code Online (Sandbox Code Playgroud)

java eclipse wsdl web-services cxf

2
推荐指数
1
解决办法
8957
查看次数

NetSuitePortType 和 NetSuiteService 有什么区别?

netsuite 文档表明使用 NetSuiteService;但我找不到要实例化的对象。我有 NetSuitePortTypeClient 代替。导入服务参考时是否遗漏了一步?

我按照本文档第 23 页上的说明进行操作:http : //www.netsuite.com/portal/partners/integration/download/SuiteTalkWebServicesPlatformGuide_2013.1.pdf

c# wsdl netsuite

2
推荐指数
1
解决办法
912
查看次数

服务器无法识别 HTTP 标头 SOAPAction 的值:

我正在尝试为此 WSDL 使用 SAAJ 调用 SOAP web 服务。我在这里提交了对这个 WSDL 的请求http://www.webservicex.net/ws/WSDetails.aspx?WSID=64,它生成了以下 SOAP 请求。

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetGeoIP xmlns="http://www.webservicex.net/">
      <IPAddress>string</IPAddress>
    </GetGeoIP>
  </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

使用 SAAJ,我生成了相同的 SOAP 请求并提交了它,但收到此错误 - 服务器无法识别 HTTP 标头 SOAPAction: 的值。

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header/>
<SOAP-ENV:Body>
<GetGeoIP xmlns="http://www.webservicex.net/">
<IPAddress>SUNW</IPAddress>
</GetGeoIP>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

Java代码:

package newpackage;

import javax.xml.namespace.QName;
import javax.xml.soap.*;

public class SOAPClientSAAJ {

    public static void main(String args[]) throws Exception {
        // Create SOAP Connection
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection soapConnection = soapConnectionFactory.createConnection();

        // …
Run Code Online (Sandbox Code Playgroud)

java soap wsdl web-services

2
推荐指数
1
解决办法
2万
查看次数

WSDL 生成的 SOAPClient 无效 SOAP 1.1 消息

我有一个从 SOAP 1.2 WSDL 文件创建的 WebService 客户端。当我在客户端调用一个方法时,它会创建 SOAP 1.2 消息(我可以看到它并在处理程序中添加时间戳),但我得到

Caused by: javax.xml.soap.SOAPException: InputStream does not represent a valid SOAP 1.1 Message
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:75)
Run Code Online (Sandbox Code Playgroud)

创建的 SOAPMessage 示例:

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope">
    <S:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" S:mustUnderstand="true">
            <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-B02FCFB46EE225EA3214213243149751">gfdgdfgdfzx</wsse:BinarySecurityToken>
            <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="SIG-3">
                <ds:SignedInfo>
                    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="S"/>
                    </ds:CanonicalizationMethod>
                    <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
                    <ds:Reference URI="#TS-1">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse S"/>
                            </ds:Transform>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                        <ds:DigestValue>Cadsad</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference URI="#id-2">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList=""/>
                            </ds:Transform>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> …
Run Code Online (Sandbox Code Playgroud)

java soap wsdl soap-client

2
推荐指数
1
解决办法
4259
查看次数

发出soap请求时数组到字符串的转换错误

我正在做一个像这样的简单请求

        $wsdl = "http://.../wsdl/FileArchive";
        $client = new SoapClient($wsdl);


        $parameters= array(
                        "FileName" => "file.jpg"
                       );

        $values = $client->GetFileInfo($parameters);
Run Code Online (Sandbox Code Playgroud)

我在调用 GetFileInfo 方法时收到“数组到字符串的转换”。

该方法在 wsdl 中定义如下:

<message name="GetFileInfo0Request">
<part name="FileName" type="xs:string"/>
</message>
Run Code Online (Sandbox Code Playgroud)

我搜索过它,发现当有一些复杂类型时它可能会发生,但这里只是一个字符串。可能是什么问题呢?

php soap wsdl

2
推荐指数
1
解决办法
4262
查看次数

javax.xml.bind.UnmarshalException:意外元素(uri:“”,本地:“soap:信封”)

嗨,我已经使用 wsimport 从 WSDL 生成了 java 类。但是我已经将响应写入文件 *.xml。但是现在我想读取这个 xml 文件并填充已经生成的 java 类。

我试过了:

JAXBContext jc = JAXBContext.newInstance(Report.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
Report rc = (Report) unmarshaller.unmarshal(source);
Run Code Online (Sandbox Code Playgroud)

或者

JAXBContext jc = JAXBContext.newInstance(Report.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
Report rc = (Report) unmarshaller.unmarshal(new File("file.xml"));
Run Code Online (Sandbox Code Playgroud)

Report 是我发送请求时作为响应得到的类

在第一种情况下,我得到

javax.xml.bind.UnmarshalException: unexpected element (uri: "", local:"soap:Envelope") Expected elements are: (<{"http://pagewhereisthewsdl.com"}CLASSES>)+
Run Code Online (Sandbox Code Playgroud)

在第二种情况下

javax.xml.bind.UnmarshalException: unexpected element (uri: "http://schemas.xmlsoap.org/soap/envelope/", local:"Envelope") Expected elements are: (<{"http://pagewhereisthewsdl.com"}CLASSES>)+
Run Code Online (Sandbox Code Playgroud)

XML 是这样的:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
              <ns3:GetReportOnlineResponse xmlns:ns2="http://pagewhereisthewsdl.com/document" xmlns:ns3="http://pagewhereisthewsdl.com/endpoint">
                 <ns2:Report>
                       ...
                 </ns2:Report>
           </ns3:GetReporteOnlineResponse>
       </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

或者我能做什么?

java wsdl web-services jaxb

2
推荐指数
1
解决办法
6791
查看次数

使用 zeep / python 创建 XML 序列

我正在使用 zeep (Python 3.6) 与 SOAP API 交互,并使用包含此部分的 WSDL 模式:

<xs:element name="passengers">
    <xs:complexType>
        <xs:sequence>
            <xs:element maxOccurs="unbounded" name="passenger" type="com:PassengerType"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)

所以我希望我的 zeep 生成的 XML 看起来像这样:

<book:passengers>
    <book:passenger>
        ...redacted...
    </book:passenger>
</book:passengers>
Run Code Online (Sandbox Code Playgroud)

我用 Zeep 实现这一目标的第一次尝试如下所示:

passengers = [factories.PassengerType()]
Run Code Online (Sandbox Code Playgroud)

但是,将其发送到我的 SOAP API 时,会产生以下错误:

File "/usr/local/lib/python3.6/site-packages/zeep/xsd/elements/element.py", line 220, in validate
  "Missing element %s" % (self.name), path=render_path)
zeep.exceptions.ValidationError: Missing element passenger (createBookingRecordRequest.passengers)
Run Code Online (Sandbox Code Playgroud)

我相信这是因为我的 'passengers' 属性应该包含一个带有标签名称“passenger”的 Zeep 对象,该对象将包含我的元素列表。我已经尝试修补zeep.xsd.AnyType以实现这一目标,但尚未成功。

任何建议,将不胜感激。

python xsd soap wsdl zeep

2
推荐指数
1
解决办法
3195
查看次数

SOAP-ENV:WSDL 中的错误

我已经创建了肥皂网络服务,而且我对 SOAP 真的很陌生。在创建 Web 服务时,我面临以下问题。

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
 <SOAP-ENV:Body>
  <SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode>
   <faultstring xml:lang="en">unexpected element (uri:"http://spring.io/guides/gs-producing-web-service", local:"getUserRequest"). Expected elements are &lt;{}getUserRequest&gt;
   </faultstring>
  </SOAP-ENV:Fault>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

@Endpoint
public class UserEndpoint {
private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";

//@SuppressWarnings("unused")
private UserRepo repo;

@Autowired
public UserEndpoint(UserRepo repo) {
    this.repo = repo;
}

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getUserRequest")
@ResponsePayload
public GetUserResponse getUser(@RequestPayload GetUserRequest request) {

    GetUserResponse response = new GetUserResponse();


     response.getUser().getContact()


     System.out.println("done!!");

    return response;
}
 }
Run Code Online (Sandbox Code Playgroud)

输入 XML 文件:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:gs="http://spring.io/guides/gs-producing-web-service">
   <soapenv:Header/> …
Run Code Online (Sandbox Code Playgroud)

xml soap wsdl web-services

2
推荐指数
2
解决办法
7841
查看次数

标签 统计

wsdl ×10

soap ×6

java ×4

web-services ×4

c# ×2

php ×2

xsd ×2

.net ×1

c#-4.0 ×1

cxf ×1

eclipse ×1

jaxb ×1

netsuite ×1

python ×1

soap-client ×1

xml ×1

zeep ×1