FileDocCategorySizeDatePackage
TestElem.javaAPI DocApache Axis 1.41572Sat Apr 22 18:56:52 BST 2006samples.encoding

TestElem

public class TestElem extends Object

Fields Summary
static String
xml
Constructors Summary
Methods Summary
public static java.lang.Stringdoit(java.lang.String[] args, java.lang.String xml)


            
        ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());

        String  sURL = "http://" + args[0] + ":" + args[1] + "/axis/services/ElementService" ;
        QName   sqn  = new QName(sURL, "ElementService" );
        QName   pqn  = new QName(sURL, "ElementService" );

        //Service service=new Service(new URL("file:ElementService.wsdl"),sqn);
        Service service = new Service(new URL(sURL+"?wsdl"),sqn);
        Call    call    = (Call) service.createCall( pqn, "echoElement" );

        Options opts = new Options(args);
        opts.setDefaultURL( call.getTargetEndpointAddress() );
        call.setTargetEndpointAddress( new URL(opts.getURL()) );

        Element elem = XMLUtils.newDocument(bais).getDocumentElement();

        elem = (Element) call.invoke( new Object[] { "a string", elem } );
        return( XMLUtils.ElementToString( elem ) );
    
public static voidmain(java.lang.String[] args)

        System.out.println("Sent: " + xml );
        String res = doit(args, xml);
        System.out.println("Returned: " + res );