You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/02/02 10:20:00 UTC
svn commit: r149501 - in
webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1:
EchoString.java InteropTest_Stub.java
Author: chathura
Date: Wed Feb 2 01:19:58 2005
New Revision: 149501
URL: http://svn.apache.org/viewcvs?view=rev&rev=149501
Log:
EchoString Completed with manually written stub
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/EchoString.java
webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/InteropTest_Stub.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/EchoString.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/EchoString.java?view=diff&r1=149500&r2=149501
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/EchoString.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/EchoString.java Wed Feb 2 01:19:58 2005
@@ -31,7 +31,7 @@
InteropTest_Stub stub =new InteropTest_Stub();
URL url = new URL("http","127.0.0.1",EngineUtils.TESTING_PORT,"/axis/services/EchoXMLService");
stub.setEnePointReference(new EndpointReference(AddressingConstants.WSA_TO, url.toString()));
- stub.echoString("does this damn think work");
+ System.out.println(stub.echoString("does this damn think work"));
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/InteropTest_Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/InteropTest_Stub.java?view=diff&r1=149500&r2=149501
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/InteropTest_Stub.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/samples/org/apache/axis/samples/userguide/example1/InteropTest_Stub.java Wed Feb 2 01:19:58 2005
@@ -17,8 +17,6 @@
import java.util.Iterator;
-import javax.xml.namespace.QName;
-
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.clientapi.Call;
import org.apache.axis.engine.AxisFault;
@@ -44,17 +42,19 @@
-
- //////////////////////User setter methods//////////////////////
+ /////////////////////////////////////////////////////////////
+ /// User setter methods ///
+ /////////////////////////////////////////////////////////////
public void setEnePointReference(EndpointReference epr){
this.call.setTo(epr);
}
- //\\\\\\\\\\\\\\\\\\End user setter methods\\\\\\\\\\\\\\\\\\//
- /////////////////////Webservice Operations/////////////////////
+ ///////////////////////////////////////////////////////////////
+ /// Webservice Operations ///
+ ///////////////////////////////////////////////////////////////
public java.lang.String echoString(java.lang.String inputValue)throws AxisFault{
this.validate();
@@ -69,12 +69,6 @@
}
- //\\\\\\\\\\\\\\\\End Webservice Operations\\\\\\\\\\\\\\\\\\//
-
-
-
-
-
////////////////////////////////////////////////////////////////
// Util Methods //
@@ -84,7 +78,7 @@
protected SOAPEnvelope getSOAPEnvelopForEchoString(String value){
SOAPEnvelope envelop = OMFactory.newInstance().getDefaultEnvelope();
OMNamespace interopNamespace = envelop.declareNamespace("http://soapinterop.org/", "interop");
- OMElement echoStringMessage = omFactory.createOMElement("echoStringRequest", interopNamespace);
+ OMElement echoStringMessage = omFactory.createOMElement("echoString", interopNamespace);
OMElement text = omFactory.createOMElement("Text", interopNamespace);
text.addChild(omFactory.createText(value));
echoStringMessage.addChild(text);
@@ -104,7 +98,7 @@
}
- protected String getEchoStringFromSOAPEnvelop(SOAPEnvelope envelop){
+ protected String getEchoStringFromSOAPEnvelop(SOAPEnvelope envelop) throws AxisFault{
OMElement body = envelop.getBody();
OMElement response = null;
Iterator childrenIter = body.getChildren();
@@ -114,12 +108,20 @@
response = (OMElement)child;
}
}
- Iterator textChild = response.getChildrenWithName(new QName("", "Text"));
- String value= null;
- if(textChild.hasNext()){
- value = ((String)((OMElement)textChild.next()).getValue());
+ Iterator textChild = response.getChildren();
+ while(textChild.hasNext()){
+ OMNode child = (OMNode) textChild.next();
+ if(child instanceof OMElement && "echoStringReturn".equalsIgnoreCase(((OMElement)child).getLocalName())){
+
+ OMNode val =((OMElement)child).getFirstChild();
+ if(val instanceof OMText)
+ return new String(((OMText)val).getValue());
+
+ }
}
- return value;
+
+ this.log.info("Invalid data Binding");
+ throw new AxisFault("Invalid data Binding");
}
protected Integer getEchoIntFromSOAPEnvelop(SOAPEnvelope envelop) throws AxisFault{
@@ -152,18 +154,13 @@
protected void validate() throws AxisFault{
String errorMessage = null;
-
if(null == this.call.getTO())
errorMessage = "End Point reference is not set: ";
-
-
if(null != errorMessage){
errorMessage = "One or more Errors occured :: "+ errorMessage;
throw new AxisFault(errorMessage);
}
-
-
}
}