を見てくださいJDK 6は、JAX-WS、あなたが開発するために必要なすべてのものが付属していますWebサービスのクライアント。
私が投稿するいくつかの簡単な十分な例を見つけることができないんだけど、https://jax-ws.dev.java.net/
編集で起動します。ここでは簡単な例だ - このWebサービスのクライアント:http://xmethods.com/ve2/ViewListing.po?key=427565
C:\temp> md generated
C:\temp>"c:\Program Files\Java\jdk1.6.0_17"\bin\wsimport -keep -d generated http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl
PrimeClientを作成します。以下のように見えるのjava:
import javax.xml.ws.WebServiceRef;
import com.microsoft.webservices.*;
//the above namespace is from the generated code from the wsdl.
public class PrimeClient {
//Cant get this to work.. @WebServiceRef(wsdlLocation="http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl")
static PrimeNumbers service;
public static void main(String[] args) {
try {
service = new PrimeNumbers();
PrimeClient client = new PrimeClient();
client.doTest(args);
} catch(Exception e) {
e.printStackTrace();
}
}
public void doTest(String[] args) {
try {
System.out.println("Retrieving the port from the following service: " + service);
PrimeNumbersSoap pm = service.getPrimeNumbersSoap();
System.out.println("Invoking the getPrimeNumbersSoap operation ");
System.out.println(pm.getPrimeNumbers(100));
} catch(Exception e) {
e.printStackTrace();
}
}
}
コンパイルして実行します。
を
C:\temp>"c:\Program Files\Java\jdk1.6.0_17"\bin\javac -cp generated PrimeClient.java
C:\temp>"c:\Program Files\Java\jdk1.6.0_17"\bin\java -cp .;generated PrimeClient
Retrieving the port from the following service: com.microsoft.webservices.PrimeN
[email protected]
Invoking the getPrimeNumbersSoap operation
1,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97
出典
2009-12-01 14:38:37
nos
で正常に動作し、非常に小さなコードスニペットを生成しますが、IDEを提供していただけますあなたが使う? – JCasso
SOAPでも他のプロトコルであれ、wsdlを見ることができますか?私はそれがSOAPだと確信しています。 –
soapです:xmlns:ns2 = "http://schemas.xmlsoap.org/soap/encoding 私はEclipse IDEを使用しています – codekitty