wsdl 相关问题

Web服务描述语言(WSDL)是一种基于XML的人类和机器可读语言,用于描述Web服务。它描述了可用的Web服务方法,消息请求和响应结构,可能的故障以及通信和安全要求。此标记不引用任何名为“wsdl”的工具,例如Microsoft的WSDL.EXE。

生成错误的 SOAP 请求

我已使用此答案为我的 WSDL 生成了 WSDL 客户端。存根已成功生成,但是当我调用服务器时,我收到以下错误消息 未声明的命名空间前缀 SOAP-ENV at...

回答 1 投票 0

将 XSD 导入目标命名空间中的 WSDL 错误

使用 Apache CXF 4.0.3 中的 wsdl2java 在尝试将 XSD 导入我的 WSDL 文件时遇到错误。这些文件来自第 3 方,对于早期版本的 CXF,导入工作正常...

回答 2 投票 0

javax.xml.ws.WebServiceException:找不到名为

我在调用 SOAP Web 服务时收到以下错误 原因:javax.xml.ws.WebServiceException:找不到服务 在 wsdl 中命名为 {http://services.yell.es}LogonSrv http://piq...

回答 2 投票 0

WSDL / XSD 可用,但找不到 Web 服务 URL

在 medicare 和 medicaid 中心提供的 WSDL 中,末尾有服务名称“Core”以及端口名称“CoreSoapPort”和绑定 =“CORE:CoreSoapBinding”h.. .

回答 1 投票 0

SoapClient 不发送参数

我正在拔头发。我尝试了很多不同的方法,但没有任何效果: 我正在拔头发。我尝试了很多不同的方法,但没有任何效果: <?php // Proxy is for Fiddler $soap = new soapClient( 'http://testi.lemonsoft.eu:22000/CTP/lemonweb/userservices.svc?wsdl', array( 'proxy_host' => 'localhost', 'proxy_port' => '8888' )); try { $test = new stdClass(); $test->UserName = "foo"; $test->Password = "bar"; $test->CompanyDatabase = "baz"; // This should work: print_r($soap->LogIn($test)); /** The rest are alternative experiments, no avail: **/ print_r($soap->LogIn(array($test))); print_r($soap->LogIn(array('parameters' => $test))); print_r($soap->login(array( 'UserName' => 'foo', 'Password' =>'bar', 'CompanyDatabase' => 'baz' ))); print_r($soap->__soapCall('LogIn', array('parameters' => $test))); print_r($soap->__soapCall('LogIn', array('parameters' => array( 'UserName' => 'foo', 'Password' =>'bar', 'CompanyDatabase' => 'baz' )))); print_r($soap->LogIn(new SoapParam($test, "LogIn"))); print_r($soap->LogIn(new SoapParam(array( 'UserName' => 'foo', 'Password' =>'bar', 'CompanyDatabase' => 'baz' ), "LogIn"))); print_r($soap->__soapCall('LogIn', array('parameters' => array( new SoapParam(array( 'UserName' => 'foo', 'Password' =>'bar', 'CompanyDatabase' => 'baz' ), "LogIn") )))); } catch (SoapFault $fault) { print_r($fault); } ?> 我用 fiddler 捕获了请求,响应总是如下所示: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"> <SOAP-ENV:Body> <ns1:LogIn/> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 就好像登录参数从未发送过一样。空的 ns1:LogIn 标签真的意味着这个吗?中间是否存在一些我无法控制的实例,由于某种原因剥离参数?根据我的理解,LogIn 方法需要一个参数,根据文档,该参数应该是 PHP stdClass。 试试这个: class LogInInfo{ public $UserName = '1'; public $Password = '2'; public $CompanyDatabase = '3'; } ini_set('display_error', 1); error_reporting(E_ALL); $client = new SoapClient('http://testi.lemonsoft.eu:22000/CTP/LemonWeb/UserServices.svc?singleWsdl', array( 'classmap'=>array('LogInInfo'=>'LogInInfo'), 'debug'=>true, 'trace'=>true )); try { $info = new LogInInfo(); $resp = $client->LogIn($info); } catch(Exception $e) { var_dump($e); } print_r($client->__getLastRequest()); 结果: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.datacontract.org/2004/07/Lemonsoft.LemonsoftServiceLibrary.User" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://tempuri.org/"> <SOAP-ENV:Body> <ns2:LogIn xsi:type="ns1:LogInInfo"> <ns1:CompanyDatabase>3</ns1:CompanyDatabase> <ns1:Password>2</ns1:Password> <ns1:UserName>1</ns1:UserName> </ns2:LogIn> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 您可以显示 WSDL 文件的内容吗? ns1:LogIn 标签表示方法 LogIn 来自 ns1 命名空间(上面定义)。 我设法从 PHP 传递 SOAP 请求中的参数的唯一方法是这样的: // __setSoapHeaders here $listCriteriaXML = '<List xmlns="LINKHERE"> <listCriteria> <ListCriterion> <Name>DateNeeded</Name> <SingleValue>' . date("Y-m-d", strtotime("+120 days")) . '</SingleValue> </ListCriterion> <ListCriterion> <Name>limitresults</Name> <SingleValue>false</SingleValue> </ListCriterion> </listCriteria> </List>'; $listCriteria = new SoapVar($listCriteriaXML, XSD_ANYXML); $response = $client->List($listCriteria); echo $client->__getLastRequest(); 我的参数也没有传播到消息中。尝试数组、stdClass、真实类、new SoapParams() ... 最后我发现,来自 WSDL 的 SoapClient getFunctions 定义的格式是参数必须单独设置到请求方法中。 所以,而不是这个,这是行不通的: $params = array("param1"=>"hello",...); $client->getMyData($params); 就我而言,使用以下内容就足够了: $client->getMyData($param1, $param2, $param3); 只需执行函数即可发现 $soapClient->__getFunctions() 如果每个函数的响应有多个参数,那么就是这种情况。每个请求函数有多个参数时的响应: Array ( [0] => MyClass getMyData(date $dateFrom, date $dateTo, string $contractNumber) [1] => OtherClass otherMethod(...),...)

回答 4 投票 0

SOAP-错误:解析 WSDL:无法在 WSDL 中找到任何可用的绑定服务

我在尝试访问 WSDL 时遇到此问题 公共函数发送(){ $选项= [ “soap_version”=> SOAP_1_2 ]; $soap = new \SoapClient('http://localhost:1025/GMSer...

回答 1 投票 0

从c#访问Web服务时出现500内部服务器错误

我已经被这个问题难住有一段时间了。我正在尝试根据 WSDL 文件中的信息创建 SOAP 请求,以发送到 Web 服务并检索响应。从...

回答 3 投票 0

JAXB 无法从soap (WSDL) 服务获取附件

我需要调用返回附件的 SOAP 服务。 定义“附加”数据的 XSD 是 我需要调用返回附件的 SOAP 服务。 定义“附加”数据的 XSD 是 <xs:complexType name="transferableFileData"> <xs:complexContent> <xs:extension base="tns:transferableFile"> <xs:sequence> <xs:element name="fileData" type="xs:base64Binary" minOccurs="0"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> 我在 pom.xml 文件中使用此插件从 WSDL 和 XSD 文件生成类 <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.15.1</version> </plugin> 自动生成的类是这样的 @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "transferableFileData", propOrder = { "fileData" }) public class TransferableFileData extends TransferableFile { protected byte[] fileData; public byte[] getFileData() { return fileData; } public void setFileData(byte[] value) { this.fileData = value; } } 服务器的响应是: Cache-Control: max-age=0 Cache-Control: no-cache Cache-Control: no-store Server-Timing: ak_p; desc="1705942361025_1611673733_335963847_52691_3577_46_71_-";dur=1 Server-Timing: origin; dur=520 Server-Timing: edge; dur=7 Server-Timing: cdn-cache; desc=MISS Connection: keep-alive Set-Cookie: LtpaToken2=Jss03JN+gXMYTd; Path=/; HttpOnly Expires: Mon Expires: 22 Jan 2024 16:52:41 GMT Pragma: no-cache Content-Length: 2912 Content-Language: en-US Date: Mon Date: 22 Jan 2024 16:52:41 GMT Content-Type: Multipart/Related; boundary="----=_Part_11_2001319686.1705942360849"; type="application/xop+xml"; start-info="text/xml" SOAPAction: "" Accept: text/xml ------=_Part_11_2001319686.1705942360849 Content-Type: application/xop+xml; charset=utf-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <[email protected]> <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:downloadPendingFileResponse xmlns:ns2="http://iris.somewhere.cp,/web_services/external/downloadFile" xmlns:ns3="http://iris.somewhere.com/web_services/external/uploadFile"><downloadPendingFileResult><fileExchangeNo>1174649</fileExchangeNo><fileName>TEST00001_2024-01-22-18.46.08.00000_APA.zip</fileName><fileData><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:[email protected]"/></fileData></downloadPendingFileResult></ns2:downloadPendingFileResponse></soapenv:Body></soapenv:Envelope> ------=_Part_11_2001319686.1705942360849 Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-ID: <[email protected]> � ������f��G��v�+p�,���� ��K�ɁZt �K�>b�La���^m��_э���1$�t�dqV�A;�ف� F�K�� ��ކO�X![ 我的Java代码是这样的: if (response instanceof JAXBElement) { DownloadPendingFileResponse downloadPendingFileResponse = ((JAXBElement<DownloadPendingFileResponse>) response).getValue(); if(downloadPendingFileResponse == null) { 及以后 final TransferableFileData transferableData = response.getDownloadPendingFileResult(); ... byte[] bytes = transferableData.getFileData(); log.info("length {}", bytes.length); 但是长度始终为零。看来我无法正确获取文件。 我注意到 WSDL 将 fileData 元素定义为 base64Binary,而 POJO 将它们定义为 byte[]。数据流似乎没有被整理。知道如何解决这个问题吗? 我在 WSDL 服务上获得了完全相同的 XSD <complexType name="myType"> <sequence> ... <element name="myFile" type="xsd:base64Binary"/> ... </sequence> </complexType> 这由 org.apache.cxf:cxf-codegen-plugin : 生成 @XmlElement(required = true) protected byte[] myFile; 但是为了进行解组,我必须将 XSLT 设置为 jaxws:feature spring 客户端,以便告诉 CXF 理解响应中的 href(文件 transform.xsl 的内容如下): <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > <xsl:key name="multiref-by-id" match="multiRef" use="@id"/> <xsl:template match="/"> <xsl:copy> <xsl:apply-templates select="@*|*"/> </xsl:copy> </xsl:template> <xsl:template match="*[starts-with(@href, '#')]"> <xsl:copy> <xsl:apply-templates select="@* | key('multiref-by-id', substring-after(@href, '#'))/@* | key('multiref-by-id', substring-after(@href, '#'))/node()"/> </xsl:copy> </xsl:template> <xsl:template match="@href[starts-with(., '#')] | multiRef[@id] | @soapenc:root"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> 这是在 XML Spring Config 中定义的 bean : <bean id="xsltFeature" class="org.apache.cxf.feature.transform.XSLTFeature"> <property name="inXSLTPath" value="transform.xsl" /> <property name="outXSLTPath" value="transform.xsl" /> </bean> <jaxws:client id="myService" serviceClass="my.web.Service" address="myurl"> <jaxws:features> <ref bean="xsltFeature" /> </jaxws:features> </jaxws:client> 通过这样做,我可以通过Java中的myFile的getter读取附件的内容,而无需额外的配置。 我认为您可以对其进行调整,以使其在您自己的应用程序上下文中工作。

回答 1 投票 0

Java、WSDL 生成的类无法转换为 javax.xml.bind.JAXBElement

我在调用 Web 服务后返回 javax.xml.bind.JAXBElementException。 JAXBElement jAXBElement = new ObjectFactory().createShowPendingFiles(showPendingFilesRe...

回答 1 投票 0

ASP.NET Core MVC:WCF 客户端不包含采用 0 个参数的构造函数

我有一个带有 WCF 的 ASP.NET Core MVC 项目。我使用 IIS 将 WCF 发布到远程服务器,并通过以下方式使用客户端: 右键单击“连接服务”> 管理连接服务...

回答 1 投票 0

Wsdl2Java 生成带有 protected List 的类<JAXBElement<?>> content

我们正在尝试与 https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/taiif/wsdl/ixgd/DpiNtnlDeclaration_v1.0.wsdl 中发布的服务集成 我们已经配置了我们的 g...

回答 1 投票 0

从现有 WSDL 构建 Django WebService

我需要重写现有的 WebService 作为 Django 应用程序的一部分,目标是将 Django 应用程序集成到只能调用此特定 WebService 的遗留系统中。 所以我...

回答 1 投票 0

如何在 Soap Request Java 中设置标头

我在形成 SOAP 请求时遇到问题。 在该请求中,我应该在标头部分而不是有效负载部分中添加用户名、密码和一些其他信息。 在 wsdl 的条目下面 我在形成 SOAP 请求时遇到问题。 在该请求中,我应该在标头部分而不是有效负载部分中添加用户名、密码和其他一些信息。 wsdl 条目下方 <wsdl:message name="InputUploadCustomerDocument_Headers"> <wsdl:part name="DocumentType" element="tns:DocumentType"/> <wsdl:part name="FileName" element="tns:FileName"/> <wsdl:part name="Password" element="tns:Password"/> <wsdl:part name="PinNo" element="tns:PinNo"/> <wsdl:part name="UserName" element="tns:UserName"/> </wsdl:message> <wsdl:message name="ReturnUploadCustomerDocument"> <wsdl:part name="parameters" element="tns:ReturnUploadCustomerDocument"/> </wsdl:message> <wsdl:operation name="UploadCustomerDocument"> <soap:operation soapAction="http://tempuri.org/ISend/UploadCustomerDocument" style="document"/> <wsdl:input name="InputUploadCustomerDocument"> <soap:header message="tns:InputUploadCustomerDocument_Headers" part="DocumentType" use="literal"/> <soap:header message="tns:InputUploadCustomerDocument_Headers" part="FileName" use="literal"/> <soap:header message="tns:InputUploadCustomerDocument_Headers" part="Password" use="literal"/> <soap:header message="tns:InputUploadCustomerDocument_Headers" part="PinNo" use="literal"/> <soap:header message="tns:InputUploadCustomerDocument_Headers" part="UserName" use="literal"/> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="ReturnUploadCustomerDocument"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> 下面的InputUploadCustomerDocument Java文件,该文件没有用户名,密码和其他字段,我需要在reuqest之前设置这些参数 @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "fileData" }) @XmlRootElement(name = "InputUploadCustomerDocument") public class InputUploadCustomerDocument { @XmlElement(name = "FileData", required = true) protected byte[] fileData; /** * Gets the value of the fileData property. * * @return * possible object is * byte[] */ public byte[] getFileData() { return fileData; } /** * Sets the value of the fileData property. * * @param value * allowed object is * byte[] */ public void setFileData(byte[] value) { this.fileData = value; } } 这是我需要调用的函数 @WebMethod(operationName = "UploadCustomerDocument", action = "http://tempuri.org/ISend/UploadCustomerDocument") @WebResult(name = "ReturnUploadCustomerDocument", targetNamespace = "http://tempuri.org/", partName = "parameters") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public ReturnUploadCustomerDocument uploadCustomerDocument( @WebParam(name = "InputUploadCustomerDocument", targetNamespace = "http://tempuri.org/", partName = "parameters") InputUploadCustomerDocument parameters); 有人可以帮助我如何设置这些标题吗? 您可以使用下面的行在发出请求之前添加标头,因为您使用的是 JAX-WS: SOAPHeader header = envelope.addHeader(); 有很多教程可以参考。转到 google 并搜索消费 SOAP Web 服务。这是一个这样的教程,您可以参考: http://www.javadb.com/using-a-message-handler-to-alter-the-soap-header-in-a-web-service-client/ 这是您可以使用的另一个很好的例子: https://soa2world.blogspot.com/2009/05/direct-web-service-client-using-java.html 希望这有帮助。

回答 1 投票 0

如何从 wsdl 生成 Web 服务

客户端向我提供了 wsdl 来生成 Web 服务。但是当我使用 wsdl.exe 命令时,它生成了 .cs 类。我在我的网络服务中使用了该课程,当我提供 ws 时...

回答 6 投票 0

使用 JAX-WS 从 Web 服务返回自定义对象

问题有点长,但我想提前提供所有信息 我有以下课程: 包test.api.soap.server; 公共类测试类A { 公共测试A级...

回答 1 投票 0

使方法参数不合格

亲爱的, 我正在尝试构建 WCF Web 服务 我有一个带有参数列表的网络方法 如下面的代码: [ServiceContract(命名空间 = "http://com.mwafaqat.update.ws")] 公共接口

回答 1 投票 0

Onvif wsdl 的 wsimport - 无服务定义

有几个类似的问题,但没有一个明确回答这个问题。 我使用 wsimport 从 .wsdl 文件(Onvif 的 wsdl 文件)生成代码。跑步 wsimport -保留 https://www...

回答 2 投票 0

WSDL 文件具有未定义的命名空间“ns1”和“xs”?

对 SOAP 和 WSDL 来说还是很陌生,但我有几个简单的问题。我在使用的 WSDL 文件中看到如下所示的部分,但名称空间 ns1 未在任何地方定义?元素

回答 1 投票 0

Onvif - 解析来自 WS-BaseNotification 的事件通知

我目前正在为 Onvif 实现一个事件处理程序。但我对 WS-BaseNotification 的解组过程完全迷失了。 我如何理解/解析NotificationMessageHolderT...

回答 1 投票 0

如何在 cxf v4 中取消反转包名称?

使用 org.apache.cxf cxf-codegen-插件 在一个新项目中,使用 v3.6.2 生成的客户端 java 类...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.