2017-12-21 12 views
0

ich ein Plugin in IntelliJ verwendet habe eine WSDL zu importieren und die viele der Client-Dateien erzeugen benötigt, um den Endpunkt zu verbinden.SOAP-Client in Java - WS-Addressing

Der Endpunkt erfordert, dass die WS-Adressierung wahr ist.

Mein aktueller Code:

/** 
* 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; 
    } 

} 

Stapel Nachricht, wenn ich versuche zu verbinden:

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". 

Meine Versuche bisher zu beheben gewesen hinzuzufügen:

@Addressing(required=true) 

Auf der Klasse. Auch versucht:

javax.xml.ws.soap.AddressingFeature(true,true) 

Auf beiden Web-Endpunkten - aber die Fehler bestehen fort. SOAPUI schlägt auch fehl, wenn die WS-Adressierung nicht auf "true" gesetzt ist.

+0

Dies ist eine WARNUNG. Kein Fehler – ACV

+0

https://stackoverflow.com/questions/25676235/wsp0075-policy-assertion-transportbinding-was-evaluated-as-unknown-why – ACV

+0

https://stackoverflow.com/questions/4427650/how-to- hide-warning-in-jax-ws-client-was-vielleicht-verursacht-durch-jax-ws-library – ACV

Antwort

0

Es scheint, dass initally hatte ich eine Art und war eigentlich eine Ausnahme

Exception in thread "Thread-2" javax.xml.ws.soap.SOAPFaultException: MustUnderstand headers:[{http://www.w3.org/2005/08/addressing}Action] are not understood 

ich richtig hinzugefügt bekommen:

new javax.xml.ws.soap.AddressingFeature(true,true) 

Und als ACV darauf hingewiesen, die anderen Meldungen sind Warnungen.