Soap JAX-WS客户端请求类

Soap JAX-WS客户端请求类,soap,jax-ws,Soap,Jax Ws,我试图创建一个基于soap的java客户机来使用基于soap的web服务。CorbisImageSoap.java和CorbisImage.java是从wsimport自动生成的。我可以在SOAPUI中提交请求,但是我无法让我的java客户机(corbiclient.java)工作。我不确定我需要如何处理Holder searchResultDataXML和Holder imagesXML。它们看起来与响应相关,但我不确定如何处理这些请求,因为它们是搜索api中的参数。有什么想法吗?当我执行co

我试图创建一个基于soap的java客户机来使用基于soap的web服务。CorbisImageSoap.java和CorbisImage.java是从wsimport自动生成的。我可以在SOAPUI中提交请求,但是我无法让我的java客户机(corbiclient.java)工作。我不确定我需要如何处理Holder searchResultDataXML和Holder imagesXML。它们看起来与响应相关,但我不确定如何处理这些请求,因为它们是搜索api中的参数。有什么想法吗?当我执行corbiclient.java时,我得到“Length不能小于零。参数名称:Length”

soap客户端执行下面的搜索方法

public class CorbisClient {
    public static void main(String[] args){
        CorbisImage service = new CorbisImage();
        CorbisImageSoap port = service.getCorbisImageSoap();
        String sessionUID="valid id";
        String eSTok="valid param";
        String sVTok="";
        String itemsPerPage="20";
        String startPosition="1";
        String imageSearchRequestDataXML="xml here";
        String imageFormatDataXML="xml here";
        Holder<String> searchResultDataXML=new Holder<String>();
        Holder<String> imagesXML=new Holder<String>();
        port.search(sessionUID, eSTok, sVTok, itemsPerPage, startPosition, imageSearchRequestDataXML, imageFormatDataXML, searchResultDataXML, imagesXML);
    }
}
SOAPUI响应:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Header>
      <wsu:Timestamp xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
         <wsu:Created>2011-08-10T05:04:00Z</wsu:Created>
         <wsu:Expires>2011-08-10T05:09:00Z</wsu:Expires>
      </wsu:Timestamp>
   </soap:Header>
   <soap:Body>
      <SearchResponse xmlns="http://c1.net.corbis.com/">
         <searchResultDataXML><![CDATA[<SearchResultData><SearchRequestUID Scope="Public" Type="Guid" Value="{34a38c64-5dbc-48df-8874-74d789a0dacd}"/><StartPosition Scope="Public" Type="Long" Value="1"/><EndPosition Scope="Public" Type="Long" Value="20"/><TotalHits Scope="Public" Type="Long" Value="323516"/></SearchResultData>]]></searchResultDataXML>
         <imagesXML><![CDATA[<Images><Image><ImageUID Scope="Public" Type="Guid" Value="{7f2535d0-9a41-4997-9694-0a4de569e6d9}"/><CorbisID Scope="Public" Type="String" Value="42-15534232"/><Title Scope="Public" Type="String" Value="Animal"/><CreditLine Scope="Public" Type="String" Value="© Robert Llewellyn/Corbis"/><IsRoyaltyFree Scope="Public" Type="Boolean" Value="False"/><AspectRatio Scope="Public" Type="String" Value="1.500000"/><URL128 Scope="Public" Type="String" Value="http://cachens.corbis.com/CorbisImage/thumb/15/53/42/15534232/42-15534232.jpg"/></Image></Images>]]></imagesXML>
      </SearchResponse>
   </soap:Body>
</soap:Envelope>

2011-08-10T05:04:00Z
2011-08-10T05:09:00Z
]]>
]]>
@WebServiceClient(name = "CorbisImage", targetNamespace = "http://c1.net.corbis.com/", wsdlLocation = "http://api2.corbis.com/WSCorbisOne/CorbisImage.asmx?WSDL")
    public class CorbisImage
        extends Service
    {

        private final static URL CORBISIMAGE_WSDL_LOCATION;
        private final static Logger logger = Logger.getLogger(com.corbis.net.c1.CorbisImage.class.getName());

        static {
            URL url = null;
            try {
                URL baseUrl;
                baseUrl = com.corbis.net.c1.CorbisImage.class.getResource(".");
                url = new URL(baseUrl, "http://api2.corbis.com/WSCorbisOne/CorbisImage.asmx?WSDL");
            } catch (MalformedURLException e) {
                logger.warning("Failed to create URL for the wsdl Location: 'http://api2.corbis.com/WSCorbisOne/CorbisImage.asmx?WSDL', retrying as a local file");
                logger.warning(e.getMessage());
            }
            CORBISIMAGE_WSDL_LOCATION = url;
        }

        public CorbisImage(URL wsdlLocation, QName serviceName) {
            super(wsdlLocation, serviceName);
        }

        public CorbisImage() {
            super(CORBISIMAGE_WSDL_LOCATION, new QName("http://c1.net.corbis.com/", "CorbisImage"));
        }

        /**
         * 
         * @return
         *     returns CorbisImageSoap
         */
        @WebEndpoint(name = "CorbisImageSoap")
        public CorbisImageSoap getCorbisImageSoap() {
            return super.getPort(new QName("http://c1.net.corbis.com/", "CorbisImageSoap"), CorbisImageSoap.class);
        }

        /**
         * 
         * @param features
         *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
         * @return
         *     returns CorbisImageSoap
         */
        @WebEndpoint(name = "CorbisImageSoap")
        public CorbisImageSoap getCorbisImageSoap(WebServiceFeature... features) {
            return super.getPort(new QName("http://c1.net.corbis.com/", "CorbisImageSoap"), CorbisImageSoap.class, features);
        }

        /**
         * 
         * @return
         *     returns CorbisImageSoap
         */
        @WebEndpoint(name = "CorbisImageSoap12")
        public CorbisImageSoap getCorbisImageSoap12() {
            return super.getPort(new QName("http://c1.net.corbis.com/", "CorbisImageSoap12"), CorbisImageSoap.class);
        }

        /**
         * 
         * @param features
         *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
         * @return
         *     returns CorbisImageSoap
         */
        @WebEndpoint(name = "CorbisImageSoap12")
        public CorbisImageSoap getCorbisImageSoap12(WebServiceFeature... features) {
            return super.getPort(new QName("http://c1.net.corbis.com/", "CorbisImageSoap12"), CorbisImageSoap.class, features);
        }

    }
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Header>
      <wsu:Timestamp xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
         <wsu:Created>2011-08-10T05:04:00Z</wsu:Created>
         <wsu:Expires>2011-08-10T05:09:00Z</wsu:Expires>
      </wsu:Timestamp>
   </soap:Header>
   <soap:Body>
      <SearchResponse xmlns="http://c1.net.corbis.com/">
         <searchResultDataXML><![CDATA[<SearchResultData><SearchRequestUID Scope="Public" Type="Guid" Value="{34a38c64-5dbc-48df-8874-74d789a0dacd}"/><StartPosition Scope="Public" Type="Long" Value="1"/><EndPosition Scope="Public" Type="Long" Value="20"/><TotalHits Scope="Public" Type="Long" Value="323516"/></SearchResultData>]]></searchResultDataXML>
         <imagesXML><![CDATA[<Images><Image><ImageUID Scope="Public" Type="Guid" Value="{7f2535d0-9a41-4997-9694-0a4de569e6d9}"/><CorbisID Scope="Public" Type="String" Value="42-15534232"/><Title Scope="Public" Type="String" Value="Animal"/><CreditLine Scope="Public" Type="String" Value="© Robert Llewellyn/Corbis"/><IsRoyaltyFree Scope="Public" Type="Boolean" Value="False"/><AspectRatio Scope="Public" Type="String" Value="1.500000"/><URL128 Scope="Public" Type="String" Value="http://cachens.corbis.com/CorbisImage/thumb/15/53/42/15534232/42-15534232.jpg"/></Image></Images>]]></imagesXML>
      </SearchResponse>
   </soap:Body>
</soap:Envelope>