2009-05-20 18 views
0

.NET Webサービスがあり、Java Mobile PhoneからそのWebサービスを使用しようとしています。また、WebサービスツールキットでNetBeans開発環境を使用しています。私がプロキシを作成しようとすると、簡単な型がサポートされていないことを列挙しています。 WSDLに列挙型を記述する方法はありますか?それで、ツールキットには理解できますか?JSR-172(Java ME)用のASP.NET WebサービスENUMの使用方法

答えて

0
// send a POST request to web server 
    public String sendPostRequest(String urlstring, String requeststring) 
    { 
      HttpConnection hc = null; 
      DataInputStream dis = null; 
      DataOutputStream dos = null; 

      String message = ""; 

      // specifying the query string 
      String requeststring = "request=gettimestamp"; 
      try 
      { 
        // openning up http connection with the web server 
        // for both read and write access 
        hc = (HttpConnection) Connector.open(urlstring, Connector.READ_WRITE); 

        // setting the request method to POST 
        hc.setRequestMethod(HttpConnection.POST); 
        hc.setRequestProperty("User-Agent","Profile/MIDP-2.0 Confirguration/CLDC-1.0"); 
        hc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); 


        // obtaining output stream for sending query string 
        dos = hc.openDataOutputStream(); 
        byte[] request_body = requeststring.getBytes(); 

        // sending query string to web server 
        for (int i = 0; i < request_body.length; i++) 
        { 
          dos.writeByte(request_body[i]); 
        } 
        // flush outdos.flush(); 

        // obtaining input stream for receiving HTTP response 
        dis = new DataInputStream(hc.openInputStream()); 

        // reading the response from web server character by character 
        int ch; 
        while ((ch = dis.read()) != -1) 
        { 
          message = message + (char) ch; 
        } 

      } 
      catch (IOException ioe){ 
        message = "ERROR"; 
      } 
      finally{ 
        // freeing up i/o streams and http connection 
        try{ 
          if (hc != null) 
            hc.close(); 
        } 
        catch (IOException ignored){} 
        try{ 
          if (dis != null) 
            dis.close(); 
        } 
        catch (IOException ignored){} 
        try{ 
          if (dos != null) 
            dos.close(); 
        } 
        catch (IOException ignored){} 
      } 
      return message; 
    } 
関連する問題