我正在創建一個Web服務。我想知道如何聲明參數類型並將其用於 ,因爲Java類型與例如不同。日期。我已經編寫了客戶端來使用Java中的Web服務,該服務工作正常,但我想知道是否可以使用用其他語言編寫的客戶端來使用相同的Web服務。我給你一個我的網絡服務的代碼示例:Web服務跨語言參數類型
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.ws.Endpoint;
@WebService
public class WiseQuoteServer {
@SOAPBinding(style = Style.RPC)
public String getQuote(String category) {
if (category.equals("fun")) {
return "5 is a sufficient approximation of infinity.";
}
if (category.equals("work")) {
return "Remember to enjoy life, even during difficult situatons.";
} else {
return "Becoming a master is relatively easily. Do something well and then continue to do it for the next 20 years";
}
}
public static void main(String[] args) {
WiseQuoteServer server = new WiseQuoteServer();
Endpoint endpoint = Endpoint.publish(
"http://localhost:9191/wisequotes", server);
}
}
此wlil幫助http://stackoverflow.com/questions/5726550/web-service-schema-given-a-java-class/5726901#5726901 – 2011-04-22 18:04:06