java.lang.Exception:没有这样的操作:登录j

时间:2014-04-28 11:50:03

标签: soap wsdl salesforce mule

我试图从sfdc调用mule登录网络服务。我在伙伴wsdl上使用apache cxxf wsdl2java生成了类。我尝试了所有可能的方式来发送输入,但仍然继续得到"java.lang.Exception: No such operation: login"错误

以下是我的流程:

<mule....>
    <cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true" doc:name="CXF Configuration"/>
        <flow name="mainFlow1" doc:name="mainFlow1">
          <http:inbound-endpoint exchange-pattern="request-response" path="sfdclogin" host="localhost"  port="8081" doc:name="HTTP"/>
             <scripting:component doc:name="Groovy">
                <scripting:script engine="Groovy"><![CDATA[import com.sforce.soap.partner.*;

    ObjectFactory of= new ObjectFactory();

    com.sforce.soap.partner.Login loginReq=new com.sforce.soap.partner.Login();
    loginReq.setUsername("username");
    loginReq.setPassword("password");

    return loginReq;]]></scripting:script>
            </scripting:component>
            <cxf:jaxws-client operation="login" serviceClass="com.sforce.soap.partner.SforceService" doc:name="SOAP"/>
            <https:outbound-endpoint address="https://test.salesforce.com/services/Soap/u/30.0" exchange-pattern="request-response" method="POST" doc:name="HTTPS"/>
        </flow>
</mule>

异常堆栈跟踪。如下所示,正在将正确的Login类型对象传递给SOAP组件。

Object after transform: com.sforce.soap.partner.Login@5d9683ed
The transformed object is of expected type. Type is: Login

********************************************************************************
Message               : No such operation: login. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: Login
Type                  : org.mule.api.transport.DispatchException
Code                  : MULE_ERROR--2
Payload               : com.sforce.soap.partner.Login@5d9683ed
JavaDoc               : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html
********************************************************************************
Exception stack is:
1. No such operation: login (java.lang.Exception)
  org.mule.module.cxf.CxfOutboundMessageProcessor:282 (null)
2. No such operation: login. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: Login (org.mule.api.transport.DispatchException)
  org.mule.module.cxf.CxfOutboundMessageProcessor:150 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
********************************************************************************
Root Exception stack trace:
java.lang.Exception: No such operation: login
    at org.mule.module.cxf.CxfOutboundMessageProcessor.getOperation(CxfOutboundMessageProcessor.java:282)
    at org.mule.module.cxf.CxfOutboundMessageProcessor.getOperation(CxfOutboundMessageProcessor.java:363)

WSDL:

<!-- Login Message Types -->
            <element name="login">
                <complexType>
                    <sequence>
                        <element name="username" type="xsd:string"/>
                        <element name="password" type="xsd:string"/>
                    </sequence>
                </complexType>
            </element>
 <message name="loginRequest">
        <part element="tns:login" name="parameters"/>
    </message>
 <!-- Soap PortType -->
    <portType name="Soap">
        <operation name="login">
            <documentation>Login to the Salesforce.com SOAP Api</documentation>
            <input  message="tns:loginRequest"/>
            <output message="tns:loginResponse"/>
            <fault  message="tns:LoginFault" name="LoginFault"/>
            <fault  message="tns:UnexpectedErrorFault" name="UnexpectedErrorFault"/>
            <fault  message="tns:InvalidIdFault" name="InvalidIdFault"/>
        </operation>
    </portType>

    <!-- Soap Binding -->
    <binding name="SoapBinding" type="tns:Soap">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="login">
            <soap:operation soapAction=""/>
            <input>
                <soap:header use="literal" message="tns:Header" part="LoginScopeHeader"/>
                <soap:header use="literal" message="tns:Header" part="CallOptions"/>
                <soap:body parts="parameters" use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="LoginFault">
                <soap:fault name="LoginFault" use="literal"/>
            </fault>
            <fault name="UnexpectedErrorFault">
                <soap:fault name="UnexpectedErrorFault" use="literal"/>
            </fault>
            <fault name="InvalidIdFault">
                <soap:fault name="InvalidIdFault" use="literal"/>
            </fault>
        </operation>
    </binding>

    <!-- Soap Service Endpoint -->
    <service name="SforceService">
        <documentation>Sforce SOAP API</documentation>
        <port binding="tns:SoapBinding" name="Soap">
            <soap:address location="https://test.salesforce.com/services/Soap/u/30.0"/>
        </port>
    </service>

0 个答案:

没有答案