Is
there some reason you're not using the WSDL2Java tool that generates client
stubs for you? The code it generates will manage all of the
call.set*(), QName creation, type mappings, and so on for
you.
--
Dennis R. Sherman
Endeavor Information
Systems
847-227-2976
[EMAIL PROTECTED]
http://www.endinfosys.com
-----Original Message-----
From: Quinten Verheyen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 11, 2004 3:10 AM
To: Axis-User (E-mail)
Subject: FW: client calling service that returns array possible ?In addition I add my code for the Client class :
Service service = new Service();Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setProperty(call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(call.SOAPACTION_URI_PROPERTY, "soapactionUri");
call.setOperationName( "operationName" );// From now on I'm guessing ...
// I assume I should provide the name of a local classQName qn = new QName( "CustomContainer" );// Register the type mapping, because I receive "<string>string</string><string>string</string>" as a response I use the
// Array (de)serializer classescall.registerTypeMapping(CustomContainer.class, qn, new ArraySerializerFactory(), new ArrayDeserializerFactory() );// set the QName class as a return type
call.setReturnType( qn );// Invoking the method is no problem (invokeOneWay works), catching the result properly however ..
Object results = call.invoke( new Object[] {} );
ArrayList test = (ArrayList) results; // casting to ArrayList is just a guess, but it worksfor (int i = 0; i < test.size(); i++) {
System.out.println( (String) test.get(i) );
}
The output is of the for loop is :
250ad245-6940-4b47-b474-6f2289ce15c1
e32df6d3-5999-47ce-9283-709719d7ae8a
c4a38157-706e-4ac1-a181-b90c1f9378e1The problem is .. I don't know what QName class I should provide, it doesn't matter if I provide an existing class (e.g. String.class) or a custom one. The output remains the same.
And also I don't know what the return type of the invoked call is. I guessed that an ArrayList does the job, but the output isn't readable.
Again, I didn't write the services, they just gave me a URL to the WSDL.
Any help or advice at all is very much needed and appreciated :-)-----Original Message-----
From: Quinten Verheyen
Sent: 10 February 2004 20:17
To: '[EMAIL PROTECTED]'
Subject: client calling service that returns array possible ?Hi,
I am new to Axis so if my question seems repetitive, my apologies.
I have to write a client that can call WSDL services.
Most of the services return an int, wich should pose no problem (= call.setReturnType(XMLType.XSD_INT) ).However, I am stuck when I see this :HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ResponseName xmlns="url"> <methodName> <string>string</string> <string>string</string> </methodName> </ResponseName> </soap:Body> </soap:Envelope>The method name returns an array of strings (I assume) instead of a string.
I don't know what the return type is in this case.
No matter what I try, I get a (logical) error :org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.Expected I guess, but that doesn't give me any clue about how to solve this problem.Sure I saw a couple of threads and mails about using custom (de)serializers etc. BUT I am only using that WDSL, I didn't develop it, so I cannot write
custom beans because they wouldn't be recognized. At least, that's how I understood it.I sure would appreciate the help, cause this thing needs to be solved quite quickly ..Verheyen Quinten
Software EngineerRue Gabrielle Petitstraat 4/61080 BrusselTel : +0032 (0)2 502 85 00Fax : +0032 (0)2 502 76 07
Gsm : +0032 (0)494 81 04 81E-mail : [EMAIL PROTECTED]
Politicians' Syllogism :
step 1 : we must do something.
step 2 : this is something.
step 3 : therefore we must do it.
