File: put.java

package info (click to toggle)
axis 1.4-29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 52,100 kB
  • sloc: java: 129,124; xml: 10,602; jsp: 983; sh: 84; cs: 36; makefile: 18
file content (43 lines) | stat: -rw-r--r-- 1,362 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package test;

import org.apache.axis.Message;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.utils.Options;

import java.io.File;
import java.io.FileInputStream;

/**
 * A convenient little test program which will send a message as is to
 * the server.  Useful for debugging interoperability problems or
 * handling of ill-formed messages that are hard to reproduce programmatically.
 *
 * Accepts the standard options, followed by a list of files containing
 * the contents to be sent.
 */
class put {
    static void main(String[] args) throws Exception {
        Options opts = new Options(args);
        String action = opts.isValueSet('a');

        Service  service = new Service();
        Call     call    = (Call) service.createCall();

        call.setTargetEndpointAddress( new java.net.URL(opts.getURL()) );
        if (action != null ) {
            call.setUseSOAPAction( true );
            call.setSOAPActionURI( action );
        }
  
        args = opts.getRemainingArgs();
        for (int i=0; i<args.length; i++) {
            FileInputStream stream = new FileInputStream(new File(args[i]));
            call.setRequestMessage(new Message(stream));
    
            call.invoke();
        
            System.out.println(call.getResponseMessage().getSOAPPartAsString());
        }
    }
}