axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "angeloimm" <>
Subject Question about Axis1.2RC3
Date Thu, 28 Apr 2005 11:20:58 GMT
Hi all; first of all i want to thank Anne Thomas Manes for her tips.
I want to ask a thing i have a web service built in java; it is a java class that has several
Now in my axis.wsdd i have added a service like this one:
    <service name="Interaction" type="" regenerateElement="false"
        provider="java:MSG" style="message" use="literal" validate="false">
        <parameter name="scope" value="Request" regenerateElement="false"/>
        <parameter name="className"
            value="it.eng.napsi.websrv.javabean.Interaction" regenerateElement="false"/>
        <parameter name="allowedMethods" value="*" regenerateElement="false"/>
        <operation name="byFiscalCode"
            returnType="xsd:anyType" qname="ns1:byFiscalCode"
            regenerateElement="false" xmlns:ns1=""/>

Now i have this simple client:
package it.eng.test.client.util;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.message.SOAPBody;
import org.apache.axis.utils.XMLUtils;
import javax.xml.rpc.ServiceException;

import java.util.Vector;
import org.w3c.dom.Document;
import javax.xml.namespace.QName;

import org.apache.log4j.Logger;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import java.util.*;

import it.eng.napsi.input.individuo.IndividualMarshaller;

public class SimpleAxisClient {
    public SimpleAxisClient() {

    private static final Logger LOG = Logger.getLogger(SimpleAxisClient.class.

    private Call getCall(String endpoint, String operation) throws
            ServiceException {

        if (LOG.isDebugEnabled()) {

            LOG.debug("Creating call.....");
        Call result = (Call) (new Service()).createCall();
        try {
            result.setTargetEndpointAddress(new URL(endpoint));

        } catch (MalformedURLException ex) {


        result.setOperation(new QName(endpoint, operation), operation);
        if (LOG.isDebugEnabled()) {

        return result;

    public Document getDocument(Document doc, String endpoint,
                                String operation) throws Exception {
        Call call = getCall(endpoint, operation);
        Vector result = (Vector) call.invoke(new Object[] {doc});
        //Vector result = (Vector) call.invoke(new SOAPBodyElement[] { new SOAPBodyElement(
doc.getDocumentElement() )});
        SOAPBodyElement sbe = (SOAPBodyElement) result.get(0);

        if (LOG.isDebugEnabled()) {

            LOG.debug("Body ricevuto: " +
        return sbe.getAsDocument();

    public static void main(String args[]) throws Exception {

        IndividualMarshaller ind = new IndividualMarshaller();
        Map envi = new Hashtable();
        envi.put( "codFisc","MMDNGL74C22H703K" );
        //String xmlString = ind.toStringDocument( envi );
        String xmlString = "<impl:doc xmlns:impl=''>"+
        String xmlString = "<impl:byFiscalCod xmlns:impl=''>"+
        System.out.println( xmlString );
        SimpleAxisClient client = new SimpleAxisClient();
        Call miaCall = client.getCall(
        Document doc = XMLUtils.newDocument(new;
        System.out.println("doc.getDocumentElement(): " +
        Vector result = (Vector) miaCall.invoke
                        (new SOAPBodyElement[] {new SOAPBodyElement(doc.
        SOAPBodyElement sbe = (SOAPBodyElement) result.get(0);

        System.out.println( "Ottenuto: "+ XMLUtils.DocumentToString( sbe.getAsDocument() )

As you can see i have this file xml:

<impl:byFiscalCode xmlns:impl=''>

Now by doing so the method is called... but the document that it receives is the file xml
that i have showed before; i'ld like that the document that the operation byFiscalCode accepts

How can i do?
If i must insert the operation name in the xml ( that is: <impl:byFiscalCode ) why must
i use the 

setOperation(new QName(endpoint, operation), operation) method of Call object?
Thanks to all

6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!

View raw message