Hi,

I'm trying to make a call to a Web Service and specify the type for every
parameter. To make the call I use the following code :

                Service service = new Service();
                Call call = null;
                try {
                        call = (Call) service.createCall();
                } catch (ServiceException SEx) {
                        logger.warning(
                                "Caught ServiceException while creating a
new SOAP Call\n"
                                        + SEx.getLocalizedMessage());
                        return null;
                }
                call.setTargetEndpointAddress(sc.getEndpointURL());

                //make the SOAP body
                SOAPBodyElement requestBody = new SOAPBodyElement();
                requestBody.setName(sc.getMethodName());
                requestBody.setNamespaceURI(sc.getNamespaceURI());

                //add children for parameters
                try {
                        for (int i = 0; i < params.length; i++) {
                                SOAPBodyElement soapBEParam =
params[i].makeSOAPBodyElement();
        
soapBEParam.setType(org.apache.axis.Constants.XSD_STRING);
                                try {
                                        logger.finest("***** TESTING
*****\n" + DOMSerializer.Serialize(soapBEParam.getAsDocument())); 
                                } catch (Exception e) {
                                        e.printStackTrace();
                                }
                                requestBody.addChildElement(soapBEParam);
                        }
                } catch (SOAPException SOAPEx) {
                        logger.warning(
                                "Caught a SOAPException while adding
parameters to the SOAPBodyElement\n"
                                        + SOAPEx.getLocalizedMessage());
                        return null;
                }

But it seems to me that the type is not set. Is it the right method ? I also
tried by adding an xsi:type attribute but with no luck.

Regards,
Jerome

Reply via email to