1

Java Web サービス クラスから、Sudzc.com でサポートされている WSDL ファイルを生成して Objective-C コードを生成する方法は?

簡単な例でやってみました。

私の Java Web サービス クラス:

package main;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

@WebService(name="RectangleWebService", serviceName = "RectangleWebService", portName = "RectangleWebServicePort", targetNamespace = "http://www.mywstest.com/ws/rectangle")
public class RectangleService {
    @WebMethod(action="calculateValueOne")
    public @WebResult(name="ValueOne") float calculateValueOne(@WebParam(name="Length") float length, @WebParam(name="Width")float width){
        return 2*(length+width);
    }
    @WebMethod(action="calculateValueTwo")
    public @WebResult(name="ValueTwo") float calculateValueTwo(@WebParam(name="Length") float length, @WebParam(name="Width")float width){
        return (length*width);
    }

}

Ant スクリプトと wsgen を使用して WSDL ファイルを作成し、それをhttp://sudzc.comにアップロードして、Objective-C コード (ARC を使用した iOS 用の Objective-C) を作成しました。私の問題は、Sudzc.com から作成された Objective-C コードにインスタンス メソッドがないことです...

これは私の WSDL ファイルです。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. -->
<definitions targetNamespace="http://www.mywstest.com" name="RectangleWebService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.mywstest.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <import namespace="http://www.mywstest.com/ws/rectangle" location="RectangleWebServicePortType.wsdl"/>
  <binding name="RectangleWebServicePortBinding" type="ns1:RectangleWebService" xmlns:ns1="http://www.mywstest.com/ws/rectangle">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="calculateValueOne">
      <soap:operation soapAction="calculateValueOne"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
    <operation name="calculateValueTwo">
      <soap:operation soapAction="calculateValueTwo"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="RectangleWebService">
    <port name="RectangleWebServicePort" binding="tns:RectangleWebServicePortBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
    </port>
  </service>
</definitions>

http://www.w3schools.com/webservices/tempconvert.asmx?WSDLの WSDL ファイルを使用して sudzc.com で Objective-C コードを生成すると、問題なく動作し、Web のインスタンス メソッドを使用できます。私のObjective-Cプロジェクトのサービス... !!!

おそらく誰かが助けることができますか?

PS私の悪い英語で申し訳ありません。私はWebサービスのまったくの初心者です...

4

2 に答える 2

0

その sudzC にはメモリに関する多くの問題があります。私は WSClient++ を使用してクラスを生成しましたが、問題はありませんでした。

http://wsclient.neurospeech.com/

于 2012-09-12T18:17:05.193 に答える
-1

問題は、生成された RectangleWebService.wsdl ファイルに、外部 schema1.xsd ファイルからのスキーマ インポートがあることです...

だから私は1つのwsdlファイルを作成しなければならず、それはsudzc.comで動作するはずです...

私の推測は正しいですか?

于 2012-08-07T12:16:41.477 に答える