TanWS 0 Newbie Poster

Hi All,

I'am having trouble passing image take from j2me application to asp.net C# webservice. I tried converting the image in byte[] to base64 string and pass to webmethod that receive a string and received the following error. Please help!


javax.xml.rpc.JAXRPCException: error 0 during TCP write
at com.sun.j2mews.xml.rpc.SOAPEncoder.encode(+248)
at com.sun.j2mews.xml.rpc.OperationImpl.invoke(+40)
at YOGStub.YOGWebServiceSoap_Stub.faultImage(+42)
at SnapperMIDlet$3.run(+28)

and the codes for the j2me method used to pass the string to webservice:

public void capture() {
		try {
			// Get the image.
			raw = mVideoControl.getSnapshot(null);
			Image image = Image.createImage(raw, 0, raw.length);

			Thread t = new Thread() {
				public void run() {
					YOGWebServiceSoap_Stub service = new YOGWebServiceSoap_Stub();
					try {

						try {
							String value = Base64.encode(raw, 0, raw.length);
							//passing the converted string"value" to webservice -->
service.faultImage(value);
						} catch (Exception e) {
							e.printStackTrace();
						}

					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			};
			t.start();

			Image thumb = createThumbnail(image);

			// Place it in the main form.
			if (mMainForm.size() > 0 && mMainForm.get(0) instanceof StringItem)
				mMainForm.delete(0);
			mMainForm.append(thumb);

			// Flip back to the main form.
			mDisplay.setCurrent(mMainForm);

			// Shut down the player.
			mPlayer.close();
			mPlayer = null;
			mVideoControl = null;
		} catch (MediaException me) {
			handleException(me);
		}
	}

and the codes for the webservice on asp.net c#

[WebMethod]
    public void FaultImage(string byteStringIn)
    {
        byte[] byteArrayIn = Convert.FromBase64String(byteStringIn);

        MemoryStream ms = new MemoryStream(byteArrayIn);
        Image returnImage = Image.FromStream(ms);
        returnImage.Save("C:\\OOOOOOOO.jpg");
    }

Thanks and regards,
TanWS