我的工具集由Eclipse,CXF 2.5.1和OpenJDK 6组成。
从wsdl生成webclient时,我会收到引用其名称的错误,其中包含斜杠:'soap/SomeService' is not a valid value for 'QName' / 'NCName'
。
用点替换斜杠我可以生成客户端但是(在还原之后)我在调用服务时遇到异常。
我尝试用%2F替换斜杠,但这也不起作用。
来源wsdl:
<wsdl:service name="soap/SomeService">
<wsdl:port binding="impl:soap/SomeServiceSoapBinding" name="soap/SomeService">
<wsdlsoap:address location="http://domain/axis/services/soap/SomeService"/>
</wsdl:port>
</wsdl:service>
生成的soap服务文件:
@WebServiceClient(name = "soap/SomeService",
wsdlLocation = "http://domain/axis/services/soap/SomeService?wsdl",
targetNamespace = "http://soap.some.service.net")
public class SoapSomeService extends javax.xml.ws.Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://soap.some.service.net", "soap/SomeService");
public final static QName SoapSomeService = new QName("http://soap.some.service.net", "soap/SomeService");
static {
URL url = null;
try {
url = new URL("http://domain/axis/services/soap/SomeService?wsdl");
} catch (MalformedURLException e) {
java.util.logging.Logger.getLogger(SoapSomeService.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "http://domain/axis/services/soap/SomeService?wsdl");
}
WSDL_LOCATION = url;
}
...
堆栈跟踪:
Caused by: javax.xml.ws.WebServiceException: Illegal endpoint address: ${endpoint.servicemanager}
at com.sun.xml.internal.ws.api.EndpointAddress.create(EndpointAddress.java:133)
at com.sun.xml.internal.ws.client.RequestContext.setEndPointAddressString(RequestContext.java:143)
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:616)
at com.sun.xml.internal.ws.api.PropertySet$MethodAccessor.set(PropertySet.java:285)
at com.sun.xml.internal.ws.api.PropertySet.put(PropertySet.java:345)
at com.sun.xml.internal.ws.client.RequestContext.put(RequestContext.java:254)
at com.sun.xml.internal.ws.client.RequestContext$MapView.put(RequestContext.java:352)
at com.sun.xml.internal.ws.client.RequestContext$MapView.put(RequestContext.java:311)
at ecard.gina.soap.SoapServiceManager.init(SoapServiceManager.java:27)
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:616)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:346)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:299)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:132)
... 30 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 1: ${endpoint.servicemanager}
at java.net.URI$Parser.fail(URI.java:2825)
at java.net.URI$Parser.checkChars(URI.java:2998)
at java.net.URI$Parser.parseHierarchical(URI.java:3082)
at java.net.URI$Parser.parse(URI.java:3040)
at java.net.URI.<init>(URI.java:595)
at com.sun.xml.internal.ws.api.EndpointAddress.<init>(EndpointAddress.java:115)
at com.sun.xml.internal.ws.api.EndpointAddress.create(EndpointAddress.java:131)
... 48 more