Web services LogicSOAPHandler inJax WS中的解组问题
我有一个SEI asWeb services LogicSOAPHandler inJax WS中的解组问题,web-services,Web Services,我有一个SEI as @WebService @SOAPBinding ( style = javax.jws.soap.SOAPBinding.Style.DOCUMENT, use = javax.jws.soap.SOAPBinding.Use.LITERAL ) @HandlerChain(file = "securityhandler.xml") public interface UserService { @WebMethod public Au
@WebService
@SOAPBinding
(
style = javax.jws.soap.SOAPBinding.Style.DOCUMENT,
use = javax.jws.soap.SOAPBinding.Use.LITERAL
)
@HandlerChain(file = "securityhandler.xml")
public interface UserService
{
@WebMethod
public AuthenticateResponse authenticateUser(AuthenticateRequest request,@WebParam(header = true, mode = Mode.IN) ApplicationCredentials credential);
}
我正在使用wsgen生成服务器端类文件和wsdl。我注意到wsgen根据我的请求(AuthenticateRequest)生成包装器,如下所示
现在我正在使用LogicalHandler截获SOAP消息,并尝试将有效负载解组到AuthenticateRequest,它会引发异常:
javax.xml.ws.WebServiceException:javax.xml.bind.UnmarshaleException:意外元素(uri:)http://ws.ecourt.com/,本地:“authenticateUser”)。预期要素包括:
我的处理程序的句柄消息实现是
@Override
public boolean handleMessage(LogicalMessageContext messageContext) {
try
{
System.out.println("in handle messgae of AuthenticationHandler");
Boolean outboundProperty = (Boolean)
messageContext.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if(outboundProperty == false)
{
JAXBContext jc = JAXBContext.newInstance(com.ecourt.ws.impl.request.AuthenticateRequest.class);
Object obj = messageContext.getMessage().getPayload(jc);
}
}
catch(Exception ex)
{
ex.printStackTrace();
return false;
}
return true;
}
这是xsd的一部分
<xs:element name="authenticateUser" type="tns:authenticateUser"/>
<xs:complexType name="authenticateUser">
<xs:sequence>
<xs:element name="arg0" type="tns:authenticateRequest" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
我只想将有效负载直接解组到AuthenticateRequest,而不是WSGen生成的AuthenticateUser。有什么办法吗?如果有任何帮助,我们将不胜感激这一问题已经解决,我需要使用LogicalMessage类中的另一个重载方法,即: Source Source=messageContext.getMessage().getPayload(); 通过源代码,我们可以处理完整的Soap地址
感谢解决了这个问题,我需要在LogicalMessage类中使用另一个重载方法,即: Source Source=messageContext.getMessage().getPayload(); 通过源代码,我们可以处理完整的Soap地址 谢谢
<xs:element name="authenticateUser" type="tns:authenticateUser"/>
<xs:complexType name="authenticateUser">
<xs:sequence>
<xs:element name="arg0" type="tns:authenticateRequest" minOccurs="0"/>
</xs:sequence>
</xs:complexType>