I have .NET Web Service and I am trying to use that web service from a Java Mobile phone. I am also using the NetBeans development environment with the web service tool kit. When I try to create the proxies, it falters on the enumerations stating that the simple types are not supported. Is there a way to describe the enumeration type in the WSDL so it is understandable to the toolkit?
views:
306answers:
1
A:
// 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;
}
yasirmturk
2009-09-18 17:00:14