【发布时间】:2015-12-18 03:43:59
【问题描述】:
我在 CXF 中遇到了 wsdl2java 的问题。它生成一个 java.lang.Object 参数而不是正确的 XACMLAuthzDecisionType。它抱怨:
操作 {urn:com:test:se:authz:AuthzService}Evaluate 无法解包,输入消息必须引用与操作相同本地名称的全局元素声明
我尝试更改输入参数的名称和相应的消息部分,但没有帮助。
生成的服务器界面如下:
@WebService(targetNamespace = "urn:com:test:se:authz:AuthzService", name = "AuthzServicePort") @XmlSeeAlso({org.w3._2000._09.xmldsig_.ObjectFactory.class, oasis.names.tc.xacml._3_0.profile.saml2_0.v2.schema.assertion.wd_13.ObjectFactory.class, oasis.names.tc. xacml._3_0.core.schema.wd_17.ObjectFactory.class,oasis.names.tc.saml._2_0.protocol.ObjectFactory.class,org.w3._2001._04.xmlenc_.ObjectFactory.class,oasis.names.tc。 saml._2_0.assertion.ObjectFactory.class,oasis.names.tc.xacml._3_0.profile.saml2_0.v2.schema.protocol.wd_13.ObjectFactory.class}) @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) 公共接口 AuthzServicePort { @WebResult(name = "Response", targetNamespace = "urn:oasis:names:tc:SAML:2.0:protocol", partName = "parameters") @WebMethod(operationName = "Evaluate", action = "urn:com:test:se:authz:AuthzService:Evaluate") 公共 oasis.names.tc.saml._2_0.protocol.ResponseType 评估( @WebParam(partName = "参数", name = "XACMLAuthzDecisionQuery", targetNamespace = "urn:oasis:names:tc:xacml:3.0:profile:saml2.0:v2:schema:protocol:wd-13") java.lang.Object 参数 ); }
我正在从命令行使用 CXF 3.1.2:
有谁知道为什么它不能生成正确的参数?
Java 类 XACMLAuthzDecisionQueryType 获得 '您正在获得这个“包罗万象”的属性,因为字段名称“Extensions”被模式的两个不同部分使用'。
我不知道这是否会导致参数生成失败。
我使用的 WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
xmlns="urn:com:test:se:authz:AuthzService"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:com:test:se:authz:AuthzService"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xacml="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
xmlns:xacml-samlp="urn:oasis:names:tc:xacml:3.0:profile:saml2.0:v2:schema:protocol:wd-13"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
name="AuthzService"
targetNamespace="urn:com:test:se:authz:AuthzService"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<wsdl:types>
<xsd:schema>
<xsd:import namespace="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
schemaLocation="http://docs.oasis-open.org/xacml/3.0/xacml-core-v3-schema-wd-17.xsd"/>
<xsd:import namespace="urn:oasis:names:tc:xacml:3.0:profile:saml2.0:v2:schema:protocol:wd-13"
schemaLocation="http://docs.oasis-open.org/xacml/3.0/xacml-3.0-profile-saml2.0-v2-schema-protocol-wd-13.xsd"/>
<xsd:import namespace="urn:oasis:names:tc:SAML:2.0:protocol"
schemaLocation="http://docs.oasis-open.org/security/saml/v2.0/saml-schema-protocol-2.0.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Evaluate">
<wsdl:part name="parameters" element="xacml-samlp:XACMLAuthzDecisionQuery"/>
</wsdl:message>
<wsdl:message name="EvaluateResponse">
<wsdl:part name="parameters" element="samlp:Response"/>
</wsdl:message>
<wsdl:portType name="AuthzServicePort">
<wsdl:operation name="Evaluate">
<wsdl:input message="tns:Evaluate"/>
<wsdl:output message="tns:EvaluateResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AuthzServiceSOAPBinding" type="tns:AuthzServicePort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Evaluate">
<soap:operation soapAction="urn:com:test:se:authz:AuthzService:Evaluate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AuthzService">
<wsdl:port name="AuthzService" binding="tns:AuthzServiceSOAPBinding" >
<soap:address location="http://localhost:8080/AuthzService/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
【问题讨论】: