我在Intellij中使用了一个插件来导入WSDL并生成连接端点所需的许多客户端文件。
结束点要求WS-Addressing为真。
我目前的代码:
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
@Addressing(required=true) // ADDED TO TRY TO FIX WS-ADDRESSING
@WebServiceClient(name = "MYService", targetNamespace = "http://tempuri.org/", wsdlLocation = "http://mybasicvanilla.com/MYService.svc?wsdl")
public class MYService
extends Service
{
private final static URL MYSERVICE_WSDL_LOCATION;
private final static WebServiceException MYSERVICE_EXCEPTION;
private final static QName MYSERVICE_QNAME = new QName("http://tempuri.org/", "MYService");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("http://mybasicvanilla.com/MYService.svc?wsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
MYSERVICE_WSDL_LOCATION = url;
MYSERVICE_EXCEPTION = e;
}
@WebEndpoint(name = "WSHttpBinding_IMYService")
public IMYService getWSHttpBindingIMYService() {
return super.getPort(new QName("http://tempuri.org/", "WSHttpBinding_IMYService"), IMYService.class,new javax.xml.ws.soap.AddressingFeature(true,true) );
}
@WebEndpoint(name = "WSHttpBinding_IMYService")
public IMYService getWSHttpBindingIMYService(WebServiceFeature... features) {
return super.getPort(new QName("http://tempuri.org/", "WSHttpBinding_IMYService"), IMYService.class, new javax.xml.ws.soap.AddressingFeature(true,true));
}
private static URL __getWsdlLocation() {
if (MYSERVICE_EXCEPTION!= null) {
throw MYSERVICE_EXCEPTION;
}
return MYSERVICE_WSDL_LOCATION;
}
}
尝试连接时发送堆栈消息:
Dec 22, 2017 9:04:05 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0075: Policy assertion "{http://www.w3.org/2006/05/addressing/wsdl}UsingAddressing" was evaluated as "UNKNOWN".
Dec 22, 2017 9:04:05 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0019: Suboptimal policy alternative selected on the client side with fitness "UNKNOWN".
到目前为止,我尝试解决的问题是添加:
@Addressing(required=true)
在课堂上。还尝试过:
javax.xml.ws.soap.AddressingFeature(true,true)
在两个网络端点上 - 但错误仍然存在。如果WS-Addressing未设置为true,则SOAPUI也会失败。
答案 0 :(得分:0)
看来我最初有一个类型,实际上是一个异常
Exception in thread "Thread-2" javax.xml.ws.soap.SOAPFaultException: MustUnderstand headers:[{http://www.w3.org/2005/08/addressing}Action] are not understood
我正确地补充道:
new javax.xml.ws.soap.AddressingFeature(true,true)
正如ACV指出其他消息是警告。