多年前,我根据给出的WSDL构建了SOAP 1.1服务。这是相当基本的:我执行了Axis的WSDL2Java并将生成的类用作基础。
现在,我被告知要迁移此服务,以便人们可以使用SOAP 1.2来访问它。
我应该在WSDL文件中进行哪些更改,以便新生成的服务(仍使用Axis的WSDL2Java)支持SOAP 1.2?
重要的是要了解我是服务提供商:我不想要仅适用于客户的解决方案。
非常感谢!
我正在使用XMLBeans绑定开发基于Axis2的WebServices.我已经使用WSDL2Java生成器生成了代码,并尝试使用请求中设置的样本值对其进行测试.
在其中一个setter方法(自动生成的代码)中,我找到了下面的代码.该方法get_store()返回一个空值,因此我得到一个NullPointerException.
target = (org.apache.xmlbeans.SimpleValue)
get_store().find_element_user(TRANSACTIONTYPE$0, 0);
Run Code Online (Sandbox Code Playgroud)
我尝试谷歌找到解决方案,发现类似的问题没有指定解决方案.
这个问题有什么解决方法吗?请帮助我
客户端错误是:
0 [main] INFO org.ws.call.BankWSCallClass - callChequeCertificationWS...
702 [main] INFO org.ws.call.BankWSCallClass - callChequeVerificationWS... serviceCreated
702 [main] INFO org.ws.call.BankWSCallClass - callChequeVerificationWS... portCreated
Exception in thread "main" org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method chequeCertification
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.ws.server.implementation.ChequeProcessingServiceStub.chequeCertification(ChequeProcessingServiceStub.java:911)
at org.ws.call.BankWSCallClass.callChequeCertificationWS(BankWSCallClass.java:53)
at org.ws.call.BankWSCallClass.main(BankWSCallClass.java:106)
Run Code Online (Sandbox Code Playgroud)
虽然服务器端错误是
[#|2012-05-10T15:52:32.390+0300|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=79;_ThreadName=Thread-2;|[ERROR] Exception occurred while trying to invoke service method chequeCertification
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114) …Run Code Online (Sandbox Code Playgroud) 尝试在Axis2中使用Rampart实现WS-Security时,我收到以下错误.
org.apache.axis2.AxisFault: Unable to engage module : rampart
at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:358)
Run Code Online (Sandbox Code Playgroud)
我在嵌入模式下使用轴(在我耳中).没有安全实现,服务正常工作.我已将该策略包含在services.xml中以及WSDL中.使用Jboss和JDK6请查看下面的文件.
Axis2.xml
<wsdl:definitions xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://service" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://service">
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service">
<xs:element name="echo">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="args0" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="echoResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="echoRequest">
<wsdl:part name="parameters" element="ns:echo"></wsdl:part>
</wsdl:message>
<wsdl:message name="echoResponse">
<wsdl:part name="parameters" element="ns:echoResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="SimpleServicePortType">
<wsdl:operation name="echo">
<wsdl:input message="ns:echoRequest" wsaw:Action="urn:echo"></wsdl:input>
<wsdl:output message="ns:echoResponse" wsaw:Action="urn:echoResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SimpleServiceSoap11Binding" …Run Code Online (Sandbox Code Playgroud) 我们有一个多模块Maven项目,依赖于javax.servlet-api 3.0.1.当我们将Axis2 1.6.2依赖项添加到我们的一个模块时,我们开始遇到编译错误.我相信这是由于我们的依赖之间的冲突:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
和Axis2依赖:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我不确定如何解决这个问题.也不了解javax.servlet-api和servlet-api工件之间的区别.
我上传了一个演示问题的小样本项目.https://github.com/chakatodd/axis2_dependency_woes
如果从module2/pom.xml中删除Axis2依赖项,则解决编译问题.
感谢您提供的任何见解.
我正在尝试连接到现有的 SOAP Web 服务。我提供了一个 wsdl,从中我通过 Apache Axis2 XMLBeans 创建了 Java 类。
但是现在我必须使用 WS-Security-Header 扩展我自己编写的客户端发送的消息。我怎样才能做到这一点?
我为此找到了 Apache Rampart 项目,但找不到任何解决方案来扩展从我的 Java 类创建的消息,并使用此类标头。我只能找到为服务建立 WS 安全性的机会(在 webapp 文件夹等中)。
我对你的回答感到兴奋!
感谢您的帮助!
您好,正在使用 wso2esb4.9.0,
我有一个生成电子邮件的服务,因为我有作为 mailbody 的属性,用于作为电子邮件的正文传递。
<property name="mailbody"
expression="fn:concat('You have received a new Ticket',':','TicketID-',get-property('Ticketid'),', ','TicketDetails-',get-property('Details'))"
scope="default"
type="STRING"/>
Run Code Online (Sandbox Code Playgroud)
当我在我的服务中传递这个属性时,我收到了一封邮件,邮件正文如下所示。
You have received a new Ticket: TicketID-3021668982752443, TicketDetails-Test ticket details
Run Code Online (Sandbox Code Playgroud)
我想在值中添加一个新行,以便邮件正文可以如下所示而不是单行。
You have received a new Ticket:
TicketID-3021668982752443,
TicketDetails-Test ticket details
Run Code Online (Sandbox Code Playgroud)
是否有任何 Xpath 函数或方法可以将新行添加到我的字符串值中。
我试图在 mailbody 属性的 fn-concat 中包含 \n 和但它不起作用。
我在使用Axis2调用.net Web服务时遇到此异常.请帮我找出解决方案.
org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.cakemarketing.affiliates.api._2.ReportsStub.clicks(ReportsStub.java:2106)
at com.infotop.common.Test.main(Test.java:49)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:276)
at org.apache.axiom.om.impl.llom.OMContainerHelper.buildNext(OMContainerHelper.java:164)
at org.apache.axiom.om.impl.llom.OMContainerHelper.getFirstOMChild(OMContainerHelper.java:182)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getFirstOMChild(OMDocumentImpl.java:201)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:98)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:544)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:540)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:188)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
... 7 more
Caused by: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:36)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.stax.dialect.SJSXPStreamReaderWrapper.next(SJSXPStreamReaderWrapper.java:138)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:651)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:189)
... 16 more
Run Code Online (Sandbox Code Playgroud) 我创建了一个 Java 客户端,以使用 Axis2 (1.7.6) 作为代码生成器与 SOAP Web 服务进行交互。问题是客户端在某些输入中抛出异常消息:
org.apache.axis2.AxisFault: Invalid white space character (0x4) in text to output (in xml 1.1, could output as a character entity)
似乎序列化程序遇到了一些被认为对 XML 规范无效的字符。我已经看到了这个问题,但没有明确的答案或修复。我没有使用 Spring 或任何其他依赖注入框架,它是一个独立的应用程序,所以我需要手动配置 Axis2 的内部。
关于如何正确修复/配置客户端的任何想法?
刚刚使用Apache Axis 2从WSDL生成Java代码.该服务受基本身份验证保护.当我尝试创建身份验证对象以设置用户名和密码时,HttpTransportProperties.Authenticator在库中找不到class().
如何为Apache Axis2生成的客户端代码设置基本身份验证?
以下是设置基本身份验证参数的旧方法:
HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername("username");
basicAuth.setPassword("password");
basicAuth.setPreemptiveAuthentication(true);
final Options clientOptions = stub._getServiceClient().getOptions();
clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
stub._getServiceClient().setOptions(clientOptions);
Run Code Online (Sandbox Code Playgroud)