我使用wsimport从wsdl文件创建了Java代码。
我想使用代理连接到Web服务,我得到了这段代码(自动生成):
package siri.siriservices;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.4-b01
* Generated source version: 2.2
*
*/
@WebServiceClient(name = "SiriServices", targetNamespace = "http://someip/Siri/SiriServices/", wsdlLocation = "file:/C:/Users/Pavel/git/stop-scanner/StopScanner/SIRI%20-%20ISRAEL/siri_wsProducer%20-%20Israel.wsdl")
public class SiriServices
extends Service
{
private final static URL SIRISERVICES_WSDL_LOCATION;
private final static WebServiceException SIRISERVICES_EXCEPTION;
private final static QName SIRISERVICES_QNAME = new QName("http://someip/Siri/SiriServices/", "SiriServices");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("file:/C:/Users/Pavel/git/stop-scanner/StopScanner/SIRI%20-%20ISRAEL/siri_wsProducer%20-%20Israel.wsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
SIRISERVICES_WSDL_LOCATION = url;
SIRISERVICES_EXCEPTION = e;
}
public SiriServices() {
super(__getWsdlLocation(), SIRISERVICES_QNAME);
}
public SiriServices(WebServiceFeature... features) {
super(__getWsdlLocation(), SIRISERVICES_QNAME, features);
}
public SiriServices(URL wsdlLocation) {
super(wsdlLocation, SIRISERVICES_QNAME);
}
public SiriServices(URL wsdlLocation, WebServiceFeature... features) {
super(wsdlLocation, SIRISERVICES_QNAME, features);
}
public SiriServices(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public SiriServices(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns SOAPPort
*/
@WebEndpoint(name = "SiriWSPort")
public SOAPPort getSiriWSPort() {
return super.getPort(new QName("http://someip/Siri/SiriServices/", "SiriWSPort"), SOAPPort.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns SOAPPort
*/
@WebEndpoint(name = "SiriWSPort")
public SOAPPort getSiriWSPort(WebServiceFeature... features) {
return super.getPort(new QName("http://someip/Siri/SiriServices/", "SiriWSPort"), SOAPPort.class, features);
}
private static URL __getWsdlLocation() {
if (SIRISERVICES_EXCEPTION!= null) {
throw SIRISERVICES_EXCEPTION;
}
return SIRISERVICES_WSDL_LOCATION;
}
}
我有一个选项可以通过将WebServiceFeature传递给getSiriWSPort构造函数来配置代理,如评论中所述:
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns SOAPPort
*/
@WebEndpoint(name = "SiriWSPort")
public SOAPPort getSiriWSPort(WebServiceFeature... features) {
return super.getPort(new QName("http://someip/Siri/SiriServices/", "SiriWSPort"), SOAPPort.class, features);
}
我找到了有关配置的信息在这里,但我找不到包含ClientProxyFeature的jar文件。
谢谢!