1

次の wsdl 定義からクライアント Web サービスを作成しました。

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="DadosBiometricos"
    targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
    xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
    xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">

    <wsp:Policy wsu:Id="WSHttpBinding_IDadosBiometricos_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:TransportToken>
                            <wsp:Policy>
                                <sp:HttpsToken RequireClientCertificate="false" />
                            </wsp:Policy>
                        </sp:TransportToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256 />
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Strict />
                            </wsp:Policy>
                        </sp:Layout>
                    </wsp:Policy>
                </sp:TransportBinding>
                <wsaw:UsingAddressing />
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>

    <wsdl:types>
        <xsd:schema targetNamespace="http://tempuri.org/Imports">
            <xsd:import
                schemaLocation="https://dadosbiometricos.valid.com.br/DadosBiometricos.svc?xsd=xsd0"
                namespace="http://tempuri.org/" />
            <xsd:import
                schemaLocation="https://dadosbiometricos.valid.com.br/DadosBiometricos.svc?xsd=xsd1"
                namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
            <xsd:import
                schemaLocation="https://dadosbiometricos.valid.com.br/DadosBiometricos.svc?xsd=xsd2"
                namespace="http://schemas.datacontract.org/2004/07/B2G_DetranGO_Biometrico" />
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="IDadosBiometricos_ConsultarBiometria_InputMessage">
        <wsdl:part name="parameters" element="tns:ConsultarBiometria" />
    </wsdl:message>
    <wsdl:message name="IDadosBiometricos_ConsultarBiometria_OutputMessage">
        <wsdl:part name="parameters" element="tns:ConsultarBiometriaResponse" />
    </wsdl:message>
    <wsdl:portType msc:usingSession="false" name="IDadosBiometricos">
        <wsdl:operation name="ConsultarBiometria">
            <wsdl:input wsaw:Action="http://tempuri.org/IDadosBiometricos/ConsultarBiometria"
                message="tns:IDadosBiometricos_ConsultarBiometria_InputMessage" />
            <wsdl:output
                wsaw:Action="http://tempuri.org/IDadosBiometricos/ConsultarBiometriaResponse"
                message="tns:IDadosBiometricos_ConsultarBiometria_OutputMessage" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="WSHttpBinding_IDadosBiometricos" type="tns:IDadosBiometricos">
    wsp:PolicyReference URI="#WSHttpBinding_IDadosBiometricos_policy" />
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="ConsultarBiometria">
            <soap12:operation               soapAction="http://tempuri.org/IDadosBiometricos/ConsultarBiometria"
                style="document" />
            <wsdl:input>
                <soap12:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="DadosBiometricos">
        <wsdl:port name="WSHttpBinding_IDadosBiometricos" binding="tns:WSHttpBinding_IDadosBiometricos">
            <soap12:address
                location="https://dadosbiometricos.valid.com.br/DadosBiometricos.svc" />
            <wsa10:EndpointReference>
                <wsa10:Address>https://dadosbiometricos.valid.com.br/DadosBiometricos.svc
                </wsa10:Address>
            </wsa10:EndpointReference>
        </wsdl:port>
    </wsdl:service>
 </wsdl:definitions>**

新しい DadosBiometricosValid() をインスタンス化しようとすると、コンストラクターで例外がスローされます。

16:25:02,296 ERROR [PolicyDeployer] Unsupported assertion!
16:25:02,297 INFO  [STDOUT] 16:25:02,297 ERROR [root] Policy not supported! #WSHttpBinding_IDadosBiometricos_policy
org.jboss.ws.WSException: Policy not supported! #WSHttpBinding_IDadosBiometricos_policy
    at org.jboss.ws.WSException.rethrow(WSException.java:60)
    at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.deployPolicyClientSide(PolicyMetaDataBuilder.java:319)
    at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.deployPolicy(PolicyMetaDataBuilder.java:277)
    at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.processPolicies(PolicyMetaDataBuilder.java:236)
    at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.processPolicyExtensions(PolicyMetaDataBuilder.java:193)
    at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:94)
    at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:140)
    at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:64)
    at javax.xml.ws.Service.<init>(Service.java:81)
    at gov.goias.valid.servico.DadosBiometricosValid.<init>(DadosBiometricosValid.java:47)
    at gov.goias.biometria.detran.ServicoValid.consultarBiometria(ServicoValid.java:43)
    at gov.goias.biometria.detran.ServicoValid.consultaBiometria(ServicoValid.java:37)
    at gov.goias.controle.detran.SalvarBiometria.salvarBiometria(SalvarBiometria.java:22)
    at gov.goias.controle.detran.SalvarBiometria.exec(SalvarBiometria.java:35)
    at gov.goias.controle.detran.ControllerDetran.doGet(ControllerDetran.java:44)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy
    at org.jboss.ws.extensions.policy.deployer.PolicyDeployer.deployClientSide(PolicyDeployer.java:173)
    at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.deployPolicyClientSide(PolicyMetaDataBuilder.java:310)
    ... 33 more

私のクラスは:

/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.1.3-b02-
 * Generated source version: 2.1
 * 
 */
@WebServiceClient(name = "DadosBiometricos", targetNamespace = "http://tempuri.org/", wsdlLocation = "https://dadosbiometricos.valid.com.br/DadosBiometricos.svc?wsdl")
public class DadosBiometricosValid
    extends Service
{

    private final static URL DADOSBIOMETRICOS_WSDL_LOCATION;
    private final static Logger logger = Logger.getLogger(DadosBiometricosValid.class.getName());

    static {

        URL url = null;
        try {
            URL baseUrl;
            baseUrl =DadosBiometricosValid.class.getResource(".");
            url = new URL(baseUrl, "https://dadosbiometricos.valid.com.br/DadosBiometricos.svc?wsdl");
        } catch (MalformedURLException e) {
            logger.warning("Failed to create URL for the wsdl Location: 'https://dadosbiometricos.valid.com.br/DadosBiometricos.svc?wsdl', retrying as a local file");
            logger.warning(e.getMessage());
        }
        DADOSBIOMETRICOS_WSDL_LOCATION = url;
    }

    public DadosBiometricosValid(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);//line that throws exception
    }

    public DadosBiometricosValid() {
        super(DADOSBIOMETRICOS_WSDL_LOCATION, new QName("http://tempuri.org/", "DadosBiometricos"));
    }

    /**
     * 
     * @return
     *     returns IDadosBiometricos
     */
    @WebEndpoint(name = "WSHttpBinding_IDadosBiometricos")
    public IDadosBiometricosValid getWSHttpBindingIDadosBiometricos() {
        return super.getPort(new QName("http://tempuri.org/", "WSHttpBinding_IDadosBiometricos"), IDadosBiometricosValid.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 IDadosBiometricos
     */
    @WebEndpoint(name = "WSHttpBinding_IDadosBiometricos")
    public IDadosBiometricosValid getWSHttpBindingIDadosBiometricos(WebServiceFeature... features) {
        return super.getPort(new QName("http://tempuri.org/", "WSHttpBinding_IDadosBiometricos"), IDadosBiometricosValid.class, features);
    }

}
4

1 に答える 1