- From: Eddie Johnston <eddie.johnston@ucd.ie>
- Date: Mon, 14 Apr 2003 13:16:12 +0100
- To: www-ws@w3.org
- Message-id: <000a01c3027f$a3d4cbc0$2f8501c1@dolphin>
Hi there, I'm trying to run a stockqoute service found at: http://www.nexus6studio.org/Services/StockQoute.asmx. it. Would anyone know what I should be filling in for the service and port name variables below? (The main error I get when I run my client is: "Server did not recognize the value of HTTP Header SOAPAction: ."). Here's the short piece of client code: import javax.xml.rpc.*; import javax.xml.namespace.QName; public class next{ private static String endpoint = "http://www.nexus6studio.org/Services/StockQoute.asmx"; private static String qnameService = "GetQuickQuote"; private static String qnamePort = ""; private static String BODY_NAMESPACE_VALUE = ""; private static String ENCODING_STYLE_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri"; private static String NS_XSD = "http://www.w3.org/2001/XMLSchema"; private static String URI_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; public static void main(String args[])throws Exception{ try{ ServiceFactory factory = ServiceFactory.newInstance(); Service service = factory.createService(new QName(qnameService)); QName port = new QName(qnamePort); Call call = service.createCall(port); call.setTargetEndpointAddress(endpoint); call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true)); call.setProperty(Call.SOAPACTION_URI_PROPERTY,""); call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING); QName QNAME_TYPE_STRING = new QName(NS_XSD,"string"); call.setReturnType(QNAME_TYPE_STRING); call.setOperationName(new QName(BODY_NAMESPACE_VALUE, "getQuickQuote"));/// call.addParameter("Ticker", QNAME_TYPE_STRING, ParameterMode.IN);/// String[] params = { "MSFT" };/// String result = (String)call.invoke(params); System.out.println(result); } catch(Exception e){ e.printStackTrace(); } } } -- ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ Once in a while you get shown the Light, In the Strangest of places if you look at it right Grateful Dead, Scarlet Begonias
Received on Monday, 14 April 2003 08:17:45 UTC