English 中文(简体)
我如何在我的中程中编篡一部陶器
原标题:How to I encode a url in my midlet

我正在制作一个中小页,以发送带有这种格式长度的散装ms网服务。

http://100.50.000.000/abcd_ws/?user=[USERNAME]&password=[PASSWORD]&from=[SENDER_ID]&to=[SINGLE_RECIPIENT]&message=[MESSAGE_TO_BE_SENT]

以下是从J2me doc处发送SMS的方法。

我如何将上述URL编码为这一方法,以便通过这一网络服务传递信息。

public void send() {
        String mReceiver = null;
               // String mPort = null;
                mReceiver= getTextField2().getString();

                String address = "sms://" + mReceiver;

        MessageConnection conn = null; 
        try {
//            String addr = "sms://" + getTextField3().getString();
            conn = (MessageConnection) Connector.open(address);
            TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
            msg.setPayloadText(getComposeSMS().getString());
            conn.send(msg);
        } catch (Exception e) {

        }
        switchDisplayable(null, getConfirmation());

    }
最佳回答

使用电话设施和使用网络服务发送SMS是不同的。 你们必须利用GET或POST方法(根据网络服务的文件),建立吉大港山区伙伴关系联系,并超越其网络服务。 阁下的《URL》包含一些参数,因此,我猜测你应当使用GET。

Take the following example http://www.java2s.com/Code/Java/J2ME/SampletodemonstrateHttpGETandPOSTfromMIDlet.htm

并视需要加以修改。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签