Sending file as attachment as well.
-- dims
On 9/21/06, Erik Norgaard <[EMAIL PROTECTED]> wrote:
Anne Thomas Manes wrote:
> The value of the SOAPAction HTTP header is a URI.
> It may be (and often is) different from the endpoint URL (i.e.,
> targetEndpointAddress).
>
> The value of the SOAPAction URI is specified in the
> definitions/binding/operation element in the WSDL in this line:
>
> <soap:operation soapAction="urn:service:operation"/>
>
> The SOAPAction URI does not need to resolve to a physical location. It
> is simply a name used to indicate what action the service should
> perform.
>
> The value of the endpoint URL is specified in the
> definitions/service/port element in the WSDL in this line:
>
> <soap:address
> location="http://company.com:8080/axis2/services/service-name"/>
>
> The endpoint URL must resolve to a physical location.
Thanks, I haven't had my brain wrapped inside out yet, and programming
Java in anything but Java just seems quite unnatural to me.
I did try to generate the java stub from a wsdl file, but this just
generated a huge bunch of files without any hint as to what to do with
them, none of the file's name corresponds to the SOAP Action or the
"portName" (the later still confuses me because I think of a port as a
tcp port which is also in play).
I'm trying to find documentation that
a) makes sense to me
b) is verbose enough to allow me to do stuff
The example in the user-guide does not make it clear to me how to
construct a soap request message, set the soap action, send the request
to the web service and receive the result. The API documentation does
not it anything clearer.
I've spent two weeks searching for documentation and trying to figure
out what this is all about, and yet I find myself unable to write a
single line of code that does stuff.
I would expect to do something like
SOAPMessage requestSoap = new SOAPMessage();
SOAPMessage responseSoap = new SOAPMessage();
requestSoap.readXMLFile("requestfile");
HttpClient socket = new HttpClient(URL
"http://localhost:8080/ws/service");
socket.connect();
socket.setHttpMethod("POST");
socket.addHttpHeader("SOAPAction","DoThis");
socket.addHttpBody(soapRequest);
socket.sendRequest();
socket.getResponse(responseSoap);
responseSoap.writeXMLFile("responsefile");
This pretty much corresponds to the flow of a RPC call, but I find it
immensely difficult to reduce the problem to anything like that from the
documentation at hand.
Is there some source of documentation that is actually consistent,
sufficient and selfcontained? - or do I need brain surgery to use Axis?
Thanks, Erik
--
Ph: +34.666334818 web: http://www.locolomo.org
X.509 Certificate: http://www.locolomo.org/crt/8D03551FFCE04F0C.crt
Key ID: 69:79:B8:2C:E3:8F:E7:BE:5D:C3:C3:B1:74:62:B8:3F:9F:1F:69:B9
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.xpath.AXIOMXPath;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLInputFactory;
import java.io.StringReader;
import java.util.List;
import java.util.Iterator;
public class GoogleSearch {
public static void main(String[] args) throws Exception {
// Replace the XXXXXXXXXXXXXXXX with your google search API key
String myKey = "XXXXXXXXXXXXXXXX";
// Create a Service Client
ServiceClient client = new ServiceClient();
// Set the options
Options options = new Options();
options.setTo(new EndpointReference("http://api.google.com/search/beta2"));
options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
client.setOptions(options);
// Construct the request to be sent.
String xml = "<m:doGoogleSearch xmlns:m=\"urn:GoogleSearch\" " +
" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" " +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
" <key xsi:type=\"xsd:string\">" + myKey + "</key>" +
" <q xsi:type=\"xsd:string\">axis2</q>" +
" <start xsi:type=\"xsd:int\">0</start>" +
" <maxResults xsi:type=\"xsd:int\">10</maxResults>" +
" <filter xsi:type=\"xsd:boolean\">false</filter>" +
" <restrict xsi:type=\"xsd:string\">\"\"</restrict>" +
" <safeSearch xsi:type=\"xsd:boolean\">false</safeSearch>" +
" <lr xsi:type=\"xsd:string\"></lr>" +
" <ie xsi:type=\"xsd:string\">latin1</ie>" +
" <oe xsi:type=\"xsd:string\">latin1</oe>" +
"</m:doGoogleSearch>";
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
OMElement request = new StAXOMBuilder(reader).getDocumentElement();
// Send the Request
OMElement response = client.sendReceive(request);
// Process the response.
AXIOMXPath xpathExpression = new AXIOMXPath("//item/URL/text()");
List nodeList = xpathExpression.selectNodes(response);
for(Iterator iterator = nodeList.iterator();iterator.hasNext();){
OMText text = (OMText)iterator.next();
System.out.println(text.getText());
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]