FileDocCategorySizeDatePackage
SOAPClientPlugin.javaAPI DocExample1390Fri Dec 06 20:35:22 GMT 2002com.wiverson.macosbook.webservices

SOAPClientPlugin.java

package com.wiverson.macosbook.webservices;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import com.wiverson.macosbook.SimpleEdit;

public class SOAPClientPlugin implements com.wiverson.macosbook.SimpleEditPlugin
{
    public SOAPClientPlugin()
    {
    }
    
    public void doAction(SimpleEdit frame, java.awt.event.ActionEvent evt)
    {
        frame.appendDocumentText(this.remoteCall());
    }
    
    public String getAction()
    {
        return "SOAP Client";
    }
    
    public void init(SimpleEdit frame)
    {
    }
    
    public static void main(String[] args)
    {
        System.out.println(new SOAPClientPlugin().remoteCall());
    }
    
    public String remoteCall()
    {
        try
        {
            String webserviceLocation =
            "http://localhost:8080/axis/SimpleWebService.jws";
            
            Service service = new Service();
            Call call    = (Call) service.createCall();
            
            call.setTargetEndpointAddress(new java.net.URL(webserviceLocation));
            
            return (String) call.invoke("now", null);
            
        } catch (Exception e)
        {
            System.err.println(e.toString());
        }
        return "Unable to connect.";
        
    }
    
}