2012-05-27 60 views
0

我在Eclipse中爲Java EE開發人員編寫了一個java類,並使用web服務嚮導使其可用作Web服務。我想從java客戶端調用它中的方法,所以我需要soap動作和命名空間,但找不到我的方法的SOAP動作。名稱空間設置爲默認名稱空間。 SOAP操作URL應該是什麼?我應該手動設置它們,Eclipse中的客戶端測試正常。在自動生成的WSDL中缺少字段

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<!--WSDL created by Apache Axis version: 1.4 
Built on Apr 22, 2006 (06:55:48 PDT)--> 
<wsdl:types> 
    <schema elementFormDefault="qualified" targetNamespace="http://DefaultNamespace" xmlns="http://www.w3.org/2001/XMLSchema"> 
    <element name="login"> 
    <complexType> 
    <sequence> 
     <element name="email" type="xsd:string"/> 
     <element name="passwd" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="loginResponse"> 
    <complexType> 
    <sequence> 
     <element name="loginReturn" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="getCourses"> 
    <complexType/> 
    </element> 
    <element name="getCoursesResponse"> 
    <complexType> 
    <sequence> 
     <element name="getCoursesReturn" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="getCourseMarks"> 
    <complexType> 
    <sequence> 
     <element name="courseID" type="xsd:int"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="getCourseMarksResponse"> 
    <complexType> 
    <sequence> 
     <element name="getCourseMarksReturn" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="getStudentMarks"> 
    <complexType> 
    <sequence> 
     <element name="id" type="xsd:int"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="getStudentMarksResponse"> 
    <complexType> 
    <sequence> 
     <element name="getStudentMarksReturn" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="listTopics"> 
    <complexType/> 
    </element> 
    <element name="listTopicsResponse"> 
    <complexType> 
    <sequence> 
     <element name="listTopicsReturn" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="getTopicRegistrants"> 
    <complexType> 
    <sequence> 
     <element name="topicName" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    <element name="getTopicRegistrantsResponse"> 
    <complexType> 
    <sequence> 
     <element name="getTopicRegistrantsReturn" type="xsd:string"/> 
    </sequence> 
    </complexType> 
    </element> 
    </schema> 
</wsdl:types> 

    <wsdl:message name="getStudentMarksRequest"> 

     <wsdl:part element="impl:getStudentMarks" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="listTopicsResponse"> 

     <wsdl:part element="impl:listTopicsResponse" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="getCourseMarksRequest"> 

     <wsdl:part element="impl:getCourseMarks" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="getCourseMarksResponse"> 

     <wsdl:part element="impl:getCourseMarksResponse" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="getCoursesResponse"> 

     <wsdl:part element="impl:getCoursesResponse" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="getTopicRegistrantsResponse"> 

     <wsdl:part element="impl:getTopicRegistrantsResponse" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="getCoursesRequest"> 

     <wsdl:part element="impl:getCourses" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="getTopicRegistrantsRequest"> 

     <wsdl:part element="impl:getTopicRegistrants" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="listTopicsRequest"> 

     <wsdl:part element="impl:listTopics" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="getStudentMarksResponse"> 

     <wsdl:part element="impl:getStudentMarksResponse" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="loginRequest"> 

     <wsdl:part element="impl:login" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="loginResponse"> 

     <wsdl:part element="impl:loginResponse" name="parameters"> 

     </wsdl:part> 

    </wsdl:message> 

    <wsdl:portType name="Services"> 

     <wsdl:operation name="login"> 

     <wsdl:input message="impl:loginRequest" name="loginRequest"> 

     </wsdl:input> 

     <wsdl:output message="impl:loginResponse" name="loginResponse"> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getCourses"> 

     <wsdl:input message="impl:getCoursesRequest" name="getCoursesRequest"> 

     </wsdl:input> 

     <wsdl:output message="impl:getCoursesResponse" name="getCoursesResponse"> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getCourseMarks"> 

     <wsdl:input message="impl:getCourseMarksRequest" name="getCourseMarksRequest"> 

     </wsdl:input> 

     <wsdl:output message="impl:getCourseMarksResponse" name="getCourseMarksResponse"> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getStudentMarks"> 

     <wsdl:input message="impl:getStudentMarksRequest" name="getStudentMarksRequest"> 

     </wsdl:input> 

     <wsdl:output message="impl:getStudentMarksResponse" name="getStudentMarksResponse"> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="listTopics"> 

     <wsdl:input message="impl:listTopicsRequest" name="listTopicsRequest"> 

     </wsdl:input> 

     <wsdl:output message="impl:listTopicsResponse" name="listTopicsResponse"> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getTopicRegistrants"> 

     <wsdl:input message="impl:getTopicRegistrantsRequest" name="getTopicRegistrantsRequest"> 

     </wsdl:input> 

     <wsdl:output message="impl:getTopicRegistrantsResponse" name="getTopicRegistrantsResponse"> 

     </wsdl:output> 

     </wsdl:operation> 

    </wsdl:portType> 

    <wsdl:binding name="ServicesSoapBinding" type="impl:Services"> 

     <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 

     <wsdl:operation name="login"> 

     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="loginRequest"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="loginResponse"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getCourses"> 

     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="getCoursesRequest"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="getCoursesResponse"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getCourseMarks"> 

     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="getCourseMarksRequest"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="getCourseMarksResponse"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getStudentMarks"> 

     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="getStudentMarksRequest"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="getStudentMarksResponse"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="listTopics"> 

     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="listTopicsRequest"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="listTopicsResponse"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

     </wsdl:operation> 

     <wsdl:operation name="getTopicRegistrants"> 

     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="getTopicRegistrantsRequest"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="getTopicRegistrantsResponse"> 

      <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

     </wsdl:operation> 

    </wsdl:binding> 

    <wsdl:service name="ServicesService"> 

     <wsdl:port binding="impl:ServicesSoapBinding" name="Services"> 

     <wsdlsoap:address location="http://localhost:8080/semisterproject/services/Services"/> 

     </wsdl:port> 

    </wsdl:service> 

</wsdl:definitions> 

回答

0

SOAP操作不一定需要調用Web服務......這取決於操作選擇算法(可以,例如,使用請求主體的構成)實施。但是,如果生成的eclipse代碼使用註釋,那麼應該可以使用@WebMethod註釋'action'屬性爲有問題的方法指定所需的soap動作,如@WebMethod(action =「MyAction」)。你可以在這個地址找到一些文件:http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.wsfep.multiplatform.doc%2Finfo%2Fae%2Fae%2Frwbs_jaxwsannotations.html 如果這沒有幫助,請發佈相關代碼以提供額外的上下文。