Tag: spring ws

使用Spring在客户端签署SOAP请求

我已经阅读了关于使用Spring-WS保护Web服务的Spring文档,但它看起来好像文章只是关于服务器端而不是客户端。 实际上,它在服务器端使用Wss4jSecurityInterceptor工作正常但我需要签署对外部Web服务的请求。 所以,第一个问题。 我是对的,Spring Web Services文档的第7章只适用于服务器端吗? 第二。 使用Spring以类似(简单,优雅)的方式向服务器端的SOAP请求添加安全性(如签名标头)是否可能? 我发现了这个问题,但看起来签名是使用Apache CXF完成的,而本文的签名是以自制方式完成的。 提前致谢。

Spring WS WSDL自动曝光:不遵循xsd导入

我正在尝试基于多个xml架构为Spring WS Web服务动态生成WSDL。 我有一个多个xsd文件,所有这些文件都是使用xsd:import元素“连接”的。 Spring WS参考说: 如果要使用包含或导入的多个模式,则需要将Commons XMLSchema放在类路径上。 如果Commons XMLSchema在类路径上,则上述元素将遵循所有XSD导入和包含,并将它们作为单个XSD在WSDL中内联。 这极大地简化了模式的部署,这仍然可以单独编辑它们。 所以我添加了这个maven依赖: org.apache.ws.xmlschema xmlschema-core 2.2.1 并以这种方式配置WSDL构建器: @Bean(name=”updateContactService”) public DefaultWsdl11Definition defaultWsdl11Definition() throws Exception { DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition(); wsdl11Definition.setPortTypeName(“updateContactPort”); wsdl11Definition.setLocationUri(“/ws/updateContact”); wsdl11Definition.setTargetNamespace(“http://spring.io/guides/gs-producing-web-service”); wsdl11Definition.setSchema(updateContactXsd()); return wsdl11Definition; } @Bean public XsdSchemaCollection updateContactXsd() throws Exception { return new SimpleXsdSchema(new ClassPathResource(“xsds/contact/outboundMessage.xsd”)); } 但生成的WSDL只包含一个架构元素(并显示导入错误的位置)。 有小费吗? Spring WS版本是2.3.1

使用Java中的WSDL访问Web服务的最快方法

我需要从Java访问Web服务。 该服务具有WSDL 。 现在我如何调用它的操作? 我已经在它上面使用了wsimport ,但是它只为操作/响应生成XML对象,实际上没有任何东西可以调用它们。 我看过Spring-WS但它看起来并不像我想要的那样(尽管它可能是解决方案的一部分)。 “wsdl”这个词根本没有出现在那个页面中。

HTTP标头中缺少Spring WebServiceTemplate SOAPAction

我很难通过Spring-ws WebServiceTemplate调用SOAP 1.2 WebService。 正在进行的请求缺少Http Header中的SOAPAction,并且服务器抛出错误“无法处理没有有效操作参数的请求。请提供有效的soap操作。” 通过wireshark进行监控,我能够发现缺少SOAP Action。 我也不支持任何代理。 通过TCP Mon(像SOAP UI这样的工具)运行请求,我确保我尝试发送的SOAP XML是有效的,并且能够获得响应。 这是我的春季配置: 这是我的java代码: public void simpleSendAndReceive() { try{ StreamSource source = new StreamSource(new StringReader(MESSAGE)); StreamResult result = new StreamResult(System.out); SoapActionCallback actionCallBack = new SoapActionCallback(“https://ecomapi.networksolutions.com/soapservice.asmx”) { public void doWithMessage(WebServiceMessage msg) { SoapMessage smsg = (SoapMessage)msg; smsg.setSoapAction(“http://networksolutions.com/ReadOrder”); } }; webServiceTemplate.sendSourceAndReceiveToResult( “https://ecomapi.networksolutions.com/soapservice.asmx”, source, new SoapActionCallback(“http://networksolutions.com/ReadOrder”), // […]

Java Spring Web服务客户端故障处理

我编写了一个与UPS Web服务一起使用的Web服务客户端(使用Java Spring和JAXB Marshaller)。 当我发送有效请求时,一切正常。 当我发送无效请求(重量> 150磅)时,UPS Web服务会响应SOAP Fault。 客户端应用程序失败了 org.springframework.oxm.UnmarshallingFailureException: JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:”http://schemas.xmlsoap.org/soap/envelope/”, local:”Fault”). 显然我的程序无法破译Web服务返回的SOAP错误。 我写了一个自定义的FaultMessageResolver,但它没有被调用。 这是代码: public class UpsRateClient extends WebServiceGatewaySupport { public UpsRateClient(WebServiceMessageFactory messageFactory) { super(messageFactory); getWebServiceTemplate().setFaultMessageResolver(new UpsFaultMessageResolver()); } public RateResponse getRate(RateRequest rateRequest) { return (RateResponse) getWebServiceTemplate().marshalSendAndReceive(rateRequest, new UpsRequestWSMC()); } private class UpsFaultMessageResolver implements FaultMessageResolver […]

如何从SOAP消息中删除空标题?

我正在使用Spring-WS来使用Webservice,如果SOAP包含有空头元素,那么它会得到补充。 我发现默认的SOAPMessage实现添加了一个。 我该如何删除它? 提前致谢

收到致命警报:unknown_ca,同时进行相互身份validation

我正在开发一个Web服务客户端,它需要与启用了相互身份validation的服务器通信。 我已经完成了以下步骤。 将服务器证书(自签名)添加到信任库,并使用SSLSocketFactory将其设置为HttpsURLConnection 。 将客户端证书(CA签名)提供给服务器管理员以将其添加到其受信任的存储中。 通过导入客户端证书创建了一个密钥库,并创建了一个密钥管理器来“HttpsURLConnection”。 当我尝试运行此示例时,我得到一个例外说法 org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: java.net.SocketException: Software caused connection abort: recv failed; nested exception is javax.xml.stream.XMLStreamException: java.net.SocketException: Software caused connection abort: recv failed at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:261) at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45) at org.springframework.ws.client.core.WebServiceTemplate.sendRequest(WebServiceTemplate.java:586) at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:549) at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502) at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:480) at test.SamlTest.request(SamlTest.java:29) at test.SamlTest.main(SamlTest.java:63) Caused by: javax.xml.stream.XMLStreamException: java.net.SocketException: Software caused connection […]

在Spring Web Services Framework中流式传输MTOM Web服务

我想使用MTOM和Spring WS将大文件从服务器发送到客户端。 我意识到这不是这类事情的最佳方法,但这是一项要求。 我有MTOM设置,它适用于50mb左右的小文件。 我遇到较大文件的内存不足错误,并通过更改不同的堆空间大小,我可以发送稍大的文件,但没有接近1GB。 1GB是我的测试用例。 如何将MTOM服务从服务器流式传输或分块到客户端? 我正在使用Java 6更新17,Tomcat 6和Spring WS 1.5.7以及SaajSoapMessageFactory。 我找到了使用jax-ws进行流式传输的示例,但我不确定如何将其合并到Spring WS端点中。 使用MTOM / XOP优化二进制数据传输

如何配置Spring-WS以使用JAXB Marshaller?

到目前为止,谢谢你的帮助,我正在更新问题,因为我没有显示我需要的所有内容,显示更改建议。 肥皂产量仍然不是我想要的。 servlet.xml中 我的注释类看起来像什么 @XmlRootElement(name = “GetTemperaturesRequest”) public class GetTemperaturesRequest { @XmlElement(required = true) protected String city; @XmlElement(required = true) @XmlSchemaType(name = “date”) protected List date; public String getCity() { return city; } public void setCity(String value) { this.city = value; } public List getDate() { if (date == null) { date = new ArrayList(); […]

如何在不使用Spring启动和使用单独的Apache tomcat服务器的情况下在Spring WS中配置双向SSL连接?

我需要以双向SSL连接安全机制向服务器发送soap请求消息,并且还处理来自服务器的Soap响应。 我使用Spring MVC和Spring ws,它完全使用注释配置并需要配置用于向服务器发送soap请求的双向SSL连接。如何在我的Spring MVC Web服务应用程序中使用双向SSL连接,以便通过SSL将我的soap消息发送到服务器?