troubleshooting Question

JAX-WS SOAP Client Request Class

Avatar of cgray1223
cgray1223 asked on
JavaJava EEWCF
3 Comments1 Solution1114 ViewsLast Modified:

I'm trying to create a soap based java client to consume a soap web service based and were automatically generated from wsimport. I'm able to submit the request in the SOAPUI just fine but I'm unable to get my java client ( to work. I'm unsure what I need to do with Holder<String> searchResultDataXML and Holder<String> imagesXML.  They look related to the response, but I'm unsure what do with these for the request as they're parameters in the Search api.  Any ideas?  I get "Length cannot be less than zero. Parameter name: length" when I execute my
soap client to execute the Search method below

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>();, eSTok, sVTok, itemsPerPage, startPosition, imageSearchRequestDataXML, imageFormatDataXML, searchResultDataXML, imagesXML);
    } is the generated method that I want to execute from

 @WebService(name = "CorbisImageSoap", targetNamespace = "")
    public interface CorbisImageSoap {
         * @param sVTok
         * @param sessionUID
         * @param searchResultDataXML
         * @param eSTok
         * @param imageSearchRequestDataXML
         * @param imagesXML
         * @param itemsPerPage
         * @param imageFormatDataXML
         * @param startPosition
        @WebMethod(operationName = "Search", action = "")
        @RequestWrapper(localName = "Search", targetNamespace = "", className = "")
        @ResponseWrapper(localName = "SearchResponse", targetNamespace = "", className = "")
        public void search(
            @WebParam(name = "sessionUID", targetNamespace = "")
            String sessionUID,
            @WebParam(name = "eSTok", targetNamespace = "")
            String eSTok,
            @WebParam(name = "sVTok", targetNamespace = "")
            String sVTok,
            @WebParam(name = "itemsPerPage", targetNamespace = "")
            String itemsPerPage,
            @WebParam(name = "startPosition", targetNamespace = "")
            String startPosition,
            @WebParam(name = "imageSearchRequestDataXML", targetNamespace = "")
            String imageSearchRequestDataXML,
            @WebParam(name = "imageFormatDataXML", targetNamespace = "")
            String imageFormatDataXML,
            @WebParam(name = "searchResultDataXML", targetNamespace = "", mode = WebParam.Mode.OUT)
            Holder<String> searchResultDataXML,
            @WebParam(name = "imagesXML", targetNamespace = "", mode = WebParam.Mode.OUT)
            Holder<String> imagesXML);

 @WebServiceClient(name = "CorbisImage", targetNamespace = "", wsdlLocation = "")
        public class CorbisImage
            extends Service
            private final static URL CORBISIMAGE_WSDL_LOCATION;
            private final static Logger logger = Logger.getLogger(;
            static {
                URL url = null;
                try {
                    URL baseUrl;
                    baseUrl =".");
                    url = new URL(baseUrl, "");
                } catch (MalformedURLException e) {
                    logger.warning("Failed to create URL for the wsdl Location: '', retrying as a local file");
                CORBISIMAGE_WSDL_LOCATION = url;
            public CorbisImage(URL wsdlLocation, QName serviceName) {
                super(wsdlLocation, serviceName);
            public CorbisImage() {
                super(CORBISIMAGE_WSDL_LOCATION, new QName("", "CorbisImage"));
             * @return
             *     returns CorbisImageSoap
            @WebEndpoint(name = "CorbisImageSoap")
            public CorbisImageSoap getCorbisImageSoap() {
                return super.getPort(new QName("", "CorbisImageSoap"), CorbisImageSoap.class);
             * @param features
             *     A list of {@link} 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("", "CorbisImageSoap"), CorbisImageSoap.class, features);
             * @return
             *     returns CorbisImageSoap
            @WebEndpoint(name = "CorbisImageSoap12")
            public CorbisImageSoap getCorbisImageSoap12() {
                return super.getPort(new QName("", "CorbisImageSoap12"), CorbisImageSoap.class);
             * @param features
             *     A list of {@link} 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("", "CorbisImageSoap12"), CorbisImageSoap.class, features);

SOAPUI Response:

 <soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
          <wsu:Timestamp xmlns:wsu="">
          <SearchResponse xmlns="">
             <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=""/></Image></Images>]]></imagesXML>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros