Генерация клиента WebService из wsdl с косой чертой - PullRequest
2 голосов
/ 16 января 2012

Мой набор инструментов состоит из Eclipse, CXF 2.5.1 и OpenJDK 6.

При создании веб-клиента из wsdl я получаю ошибки, ссылаясь на его имя, которое содержит косую черту: '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>

Сгенерированный файл сервиса мыла:

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