[jboss-user] [JBossWS] - Re: Problem consuming .net webservice with jbossws-3.0.1-nat

richard.opalka@jboss.com do-not-reply at jboss.com
Thu Apr 17 04:36:30 EDT 2008


I tried also low level approach based on sockets:


  | package org.jboss.test.ws.remoting_issue;
  | 
  | import java.io.InputStream;
  | import java.io.OutputStream;
  | import java.net.Socket;
  | 
  | public final class Test {
  | 
  | 	private static final String CRNL = "\r\n";
  | 	private static final String envelope = "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'><env:Header></env:Header><env:Body><getToken xmlns='http://webservices.maplink2.com.br'><user>user</user><pwd>password</pwd></getToken></env:Body></env:Envelope>";
  | 	private static final String msg = 
  | 		"POST /webservices/v3/Authentication/Authentication.asmx HTTP/1.1" + CRNL +
  |         "SOAPAction: \"http://webservices.maplink2.com.br/getToken\"" +  CRNL +
  |         "Content-Type: application/soap+xml; charset=UTF-8" +  CRNL +
  |         "JBoss-Remoting-Version: 22" +  CRNL +
  |         "User-Agent: JBossRemoting - 2.2.2.SP4 (Bluto)" + CRNL + 
  |         "Host: webservices.maplink2.com.br" +  CRNL +
  |         "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + CRNL + 
  |         "Connection: keep-alive" +  CRNL +
  |         "Transfer-Encoding: chunked" + CRNL +
  |         "" + CRNL +
  |         Integer.toHexString(envelope.length()) + CRNL +
  |         envelope + CRNL + "0" + CRNL;
  | 	
  | 	public static void main(String[] args) throws Exception
  | 	{
  | 		System.out.println("Sending message" + CRNL + CRNL + msg + CRNL);
  | 		System.out.println("Receiving message" + CRNL);
  | 		Socket socket = new Socket("webservices.maplink2.com.br", 80);
  | 		OutputStream os = socket.getOutputStream();
  | 		os.write(msg.getBytes());
  | 		os.flush();
  | 		InputStream is = socket.getInputStream();
  | 		copy(is, System.out);
  | 	}
  | 	
  | 	private static void copy(InputStream is, OutputStream os) throws Exception
  | 	{
  | 		byte[] buffer = new byte[128];
  | 		int count = -1;
  | 		while ((count = is.read(buffer)) != -1)
  | 		{
  | 			os.write(buffer, 0, count);
  | 		}
  | 		os.flush();
  | 	}
  | 	
  | }
  | 

but still the same result. I'm always getting HTTP 500 error code, not 501 :(

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144758#4144758

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144758



More information about the jboss-user mailing list