2014-10-08 83 views
0

我正在嘗試將WSO2與Mule集成。我已經從org \ apache \ cxf \ ws \ discovery \ wsdl文件夾下的cxf-services-ws-discovery-api.jar中獲取了WSDL,並將其放到SOAP UI中,並在localhost端口9443上打開了URL,它工作正常。但是,當我將WSDL添加到我的Mule項目並使用cxf-codegen-plugin生成客戶端存根並運行它時,我得到以下錯誤;WSO2集成

ERROR 2014-10-08 16:25:31,545 [main] com.deic.RegistryLifecycle: Trace: 
javax.xml.ws.WebServiceException: @Action and @WebMethod(action="" does not match on operation probeOp 
at com.sun.xml.ws.model.JavaMethodImpl.setWsaActions(JavaMethodImpl.java:124) 
at com.sun.xml.ws.model.JavaMethodImpl.<init>(JavaMethodImpl.java:102) 
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:664) 
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:506) 
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:337) 
at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:102) 
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:75) 
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59) 
at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:128) 
at com.sun.xml.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:803) 
at com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:810) 
at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:786) 
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:407) 
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:384) 
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:366) 
at javax.xml.ws.Service.getPort(Unknown Source) 
at org.oasis_open.docs.ws_dd.ns.discovery._2009._01.Discovery.getDiscoveryProxy(Discovery.java:79) 
at com.deic.RegistryManager.getDiscoveryProxyPort(RegistryManager.java:29) 
at com.deic.RegistryManager.getEndoint(RegistryManager.java:35) 
at com.deic.RegistryLifecycle.start(RegistryLifecycle.java:28) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237) 
at org.mule.lifecycle.RegistryLifecycleManager$RegistryLifecycleCallback.onTransition(RegistryLifecycleManager.java:273) 
at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:152) 
at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:123) 
at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:76) 
at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:136) 
at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91) 
at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87) 
at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69) 
at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) 
at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:278) 
at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:123) 
at org.mule.module.launcher.artifact.ArtifactWrapper$4.execute(ArtifactWrapper.java:98) 
at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:129) 
at org.mule.module.launcher.artifact.ArtifactWrapper.start(ArtifactWrapper.java:93) 
at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:26) 
at org.mule.module.launcher.DefaultArchiveDeployer.guardedDeploy(DefaultArchiveDeployer.java:310) 
at org.mule.module.launcher.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:330) 
at org.mule.module.launcher.DefaultArchiveDeployer.deployExplodedApp(DefaultArchiveDeployer.java:297) 
at org.mule.module.launcher.DefaultArchiveDeployer.deployExplodedArtifact(DefaultArchiveDeployer.java:108) 
at org.mule.module.launcher.DeploymentDirectoryWatcher.deployExplodedApps(DeploymentDirectoryWatcher.java:290) 
at org.mule.module.launcher.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151) 
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:150) 

這是cxf-codegen-plugin;

<plugin> 
      <groupId>org.apache.cxf</groupId> 
      <artifactId>cxf-codegen-plugin</artifactId> 
      <version>2.7.10</version> 
      <executions> 
       <execution> 
        <id>generate-sources</id> 
        <phase>generate-sources</phase> 
        <configuration> 
        <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot> 
         <wsdlOptions> 
          <wsdlOption> 
           <wsdl>${basedir}/src/main/resources/wsdd-discovery-1.1-wsdl-os.wsdl</wsdl>    
           <extraargs> 
            <extraarg>-client</extraarg> 
            <extraarg>-noAddressBinding</extraarg> 
           </extraargs> 
           </wsdlOption> 
         </wsdlOptions> 
        </configuration> 
        <goals> 
         <goal>wsdl2java</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

這是生成的類正在爆炸;

@WebService(targetNamespace = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01", name = "DiscoveryProxy") 
@XmlSeeAlso({ObjectFactory.class, org.apache.cxf.ws.addressing.ObjectFactory.class}) 
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) 
public interface DiscoveryProxy { 

@Oneway 
@Action(input = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello") 
@WebMethod(operationName = "HelloOp", action = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/HelloOp") 
public void helloOp(
    @WebParam(partName = "parameters", name = "Hello", targetNamespace = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01") 
    HelloType parameters 
); 

@WebResult(name = "ProbeMatches", targetNamespace = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01", partName = "parameters") 
@Action(input = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Probe", output = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ProbeMatches") 
@WebMethod(operationName = "ProbeOp", action = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ProbeOp") 
public ProbeMatchesType probeOp(
    @WebParam(partName = "parameters", name = "Probe", targetNamespace = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01") 
    ProbeType parameters 
); 

@Oneway 
@Action(input = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Bye") 
@WebMethod(operationName = "ByeOp", action = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ByeOp") 
public void byeOp(
    @WebParam(partName = "parameters", name = "Bye", targetNamespace = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01") 
    ByeType parameters 
); 

@WebResult(name = "ResolveMatches", targetNamespace = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01", partName = "parameters") 
@Action(input = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Resolve", output = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ResolveMatches") 
@WebMethod(operationName = "ResolveOp", action = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ResolveOp") 
public ResolveMatchesType resolveOp(
    @WebParam(partName = "parameters", name = "Resolve", targetNamespace = "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01") 
    ResolveType parameters 
); 

}

我不知道爲什麼SOAP UI沒有問題與WSDL,但客戶端存根完成。我試圖使用wireshark,但不知道如何配置HTTPS。我使用Google和Google搜索,但無法弄清楚該類的生成過程中出現了什麼問題,顯然它與生成的@Action和@WebMethod有關,但我不確定我需要做些什麼來修復WSDL這行得通。

這裏是WSDL;

<?xml version="1.0" encoding="UTF-8"?> 
    <wsdl:definitions 
    targetNamespace="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" 
    xmlns:tns="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" 
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"> 
    <wsdl:types> 
    <xs:schema> 
     <xs:import 
      namespace="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" 
      schemaLocation="wsdd-discovery-1.1-schema-os.xsd" /> 
    </xs:schema> 
    </wsdl:types> 

    <wsdl:message name="HelloMessage" > 
    <wsdl:part name="parameters" element="tns:Hello" /> 
    </wsdl:message> 

    <wsdl:message name="ByeMessage" > 
    <wsdl:part name="parameters" element="tns:Bye" /> 
    </wsdl:message> 

    <wsdl:message name="ProbeMessage" > 
    <wsdl:part name="parameters" element="tns:Probe" /> 
    </wsdl:message> 

    <wsdl:message name="ProbeMatchMessage" > 
    <wsdl:part name="parameters" element="tns:ProbeMatches" /> 
    </wsdl:message> 

    <wsdl:message name="ResolveMessage" > 
    <wsdl:part name="parameters" element="tns:Resolve" /> 
    </wsdl:message> 

    <wsdl:message name="ResolveMatchMessage" > 
    <wsdl:part name="parameters" element="tns:ResolveMatches" /> 
    </wsdl:message> 

    <wsdl:portType name="DiscoveryProxy"> 
    <wsdl:operation name="HelloOp" > 
     <wsdl:input message="tns:HelloMessage" 
     wsaw:Action 
     ="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello" 
     /> 
    </wsdl:operation> 
    <wsdl:operation name="ByeOp" > 
     <wsdl:input message="tns:ByeMessage" 
     wsaw:Action 
     ="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Bye" 
     /> 
    </wsdl:operation> 
    <wsdl:operation name="ProbeOp" > 
     <wsdl:input message="tns:ProbeMessage" 
     wsaw:Action 
     ="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Probe" 
     /> 
     <wsdl:output message="tns:ProbeMatchMessage" 
     wsaw:Action 
     ="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ProbeMatches" 
     /> 
    </wsdl:operation> 
    <wsdl:operation name="ResolveOp" > 
     <wsdl:input message="tns:ResolveMessage" 
     wsaw:Action 
     ="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Resolve" 
     /> 
     <wsdl:output message="tns:ResolveMatchMessage" 
     wsaw:Action 
     ="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ResolveMatches" 
     /> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="DiscoveryProxy" type="tns:DiscoveryProxy"> 
    <soap:binding style="document" 
     transport="http://schemas.xmlsoap.org/soap/http" /> 
    <wsdl:operation name="HelloOp"> 
     <soap:operation 
      soapAction="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/HelloOp" /> 
     <wsdl:input> 
      <soap:body use="literal" /> 
     </wsdl:input> 
    </wsdl:operation> 
    <wsdl:operation name="ByeOp"> 
     <soap:operation 
      soapAction="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ByeOp" /> 
     <wsdl:input> 
      <soap:body use="literal" /> 
     </wsdl:input> 
    </wsdl:operation> 
    <wsdl:operation name="ProbeOp"> 
     <soap:operation 
      soapAction="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ProbeOp" /> 
     <wsdl:input> 
      <soap:body use="literal" /> 
     </wsdl:input> 
     <wsdl:output> 
      <soap:body use="literal" /> 
     </wsdl:output> 
    </wsdl:operation> 
    <wsdl:operation name="ResolveOp"> 
     <soap:operation 
      soapAction="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ResolveOp" /> 
     <wsdl:input> 
      <soap:body use="literal" /> 
     </wsdl:input> 
     <wsdl:output> 
      <soap:body use="literal" /> 
     </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 

    <wsdl:service name="Discovery"> 
     <wsdl:port name="DiscoveryUDP" binding="tns:DiscoveryProxy"> 
      <soap:address location="soap.udp://:9443"/> 
     </wsdl:port> 
     <wsdl:port name="DiscoveryProxy" binding="tns:DiscoveryProxy"> 
      <soap:address location="${discovery_proxy_url}"/> 
     </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

我在WSDL上修改的唯一東西是wsdl:service上的soap:address。它在調用getDiscoveryProxy()時引發以下代碼中的異常:

Discovery service = new Discovery(); 
DiscoveryProxy port = service.getDiscoveryProxy(); 

我感謝您的任何幫助或建議,謝謝!

回答

0

我發現問題,@Action(input =「url」)需要匹配@WebMethod(action =「url」),看起來apache libs中的wsdl將它們作爲不同的url值。