0
的WSDL2Java缺少政策
我用CXF-CODEGEN-插件生成客戶端類:客戶端類:附着在WSDL
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.4</version>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdlArtifact>
<groupId>webservices</groupId>
<artifactId>ws-dosomething</artifactId>
<version>1.0-SNAPSHOT</version>
</wsdlArtifact>
</wsdlOption>
</wsdlOptions>
</configuration>
</execution>
</executions>
</plugin>
我發現,附着在「Web服務策略:WS-東西:1.0-SNAPSHOT:wsdl「在生成的類中找不到。
<cxf:bus>
<cxf:features>
<p:policies />
</cxf:features>
</cxf:bus>
<jaxws:client id="DoSomethingService" address="http://localhost/cxf/services/dosomething" serviceClass="webservices.dosomething.DoSomethingService">
<jaxws:properties>
<entry key="ws-security.signature.properties" value="crypto.properties" />
<entry key="ws-security.callback-handler" value="webservices.dosomething.WSPasswordProvider" />
</jaxws:properties>
</jaxws:client>
,服務器抱怨:當使用客戶端發送請求
org.apache.cxf.interceptor.Fault: These policy alternatives can not be satisfied:
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}AsymmetricBinding: Received Timestamp does not match the requirements
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}X509Token: The received token does not match the token inclusion requirement
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}X509Token
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}InitiatorToken
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}RecipientToken
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}IncludeTimestamp: Received Timestamp does not match the requirements
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SignedParts: {http://schemas.xmlsoap.org/soap/envelope/}Body not SIGNED
JAX-WS註解存在於客戶端類,而阿帕奇CXF的註釋,如 「@Policies」 和 「@Policy」缺失。
這是正常的嗎?我應該如何在客戶端應用策略?
謝謝。它現在有效。 「wsdlLocation」是關鍵。 – 2013-05-13 02:40:02