Apache Axis - Soap

A

Atum Sargas

Hi all,

I have read some tutorial to Soap, but I dont get the point.
My "simple" Problem is to turn the XML Soap Document into an Array

This is the starting Point of my Problems:

<-- snip ---
<?xml version="1.0" encoding="ISO-8859-1"?>

<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:si="http://soapinterop.org/xsd">
<SOAP-ENV:Body>
<dslcheckResponse>
<soapVal>

<INFO>
<RETURN_CODE xsi:type="xsd:int">104</RETURN_CODE>
<RETURN_STRING xsi:type="xsd:string">found</RETURN_STRING>
</INFO>

<RESULT xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="SOAP-ENC:Array[34]">
<item>
<STATUS>
<STATUS_CODE xsi:type="xsd:int">103</STATUS_CODE>
<STATUS_STRING
xsi:type="xsd:string">blacklisted</STATUS_STRING>
</STATUS>

<ADDRESS>
<AREACODE xsi:type="xsd:string">089</AREACODE>
<STREET xsi:type="xsd:string">Kirchenweg </STREET>
<ZIP xsi:type="xsd:string">0</ZIP>
</ADDRESS>
<BLACKLIST>
<AREACODE xsi:type="xsd:string">089</AREACODE>
<STREET xsi:type="xsd:string">Kirchenweg </STREET>
<ZIP xsi:type="xsd:string">0</ZIP>
</BLACKLIST>
<LAP>
<AREACODE xsi:type="xsd:string">089</AREACODE>
<ASB_NAME xsi:type="xsd:string">Unterföhring</ASB_NAME>
<ASB_NR xsi:type="xsd:string">950</ASB_NR>
<CITY xsi:type="xsd:string">Unterföhring</CITY>
<OPAL xsi:type="xsd:string">0</OPAL>
<REGION xsi:type="xsd:string"></REGION>
<STREET xsi:type="xsd:string">Münchner Str. 66</STREET>
<ZIP xsi:type="xsd:string">85774</ZIP>
</LAP>
<PROVIDER>
<soapVal>
<LAP_AVAILABILITY xsi:type="xsd:nil"/>
<LAP_DATE_AVAILABLE xsi:type="xsd:nil"/>
<LAP_DESCRIPTION xsi:type="xsd:nil"/>
<LAP_MIN xsi:type="xsd:nil"/>
<LAP_MAX xsi:type="xsd:nil"/>
<NAME xsi:type="xsd:nil"/>
<PRIORITY xsi:type="xsd:nil"/>
</soapVal>
</PROVIDER>
</item>

[... more of them ...]

</RESULT>


</soapVal>
</dslcheckResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

---------------snap-----------------

I dont have any problems to get the xml Data as a Document.

But what I dont understand is, how Do I read the Array into Java.
Obviously this is an String Array. But the first step to turn the
"RESULT" into an ArrayList is a problem.

My Question is how do I have to call the server to get an Array from

<RESULT xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="SOAP-ENC:Array[34]">

Or maybe its easier if somebody can explain to me how do I turn

<INFO>
<RETURN_CODE xsi:type="xsd:int">104</RETURN_CODE>
<RETURN_STRING xsi:type="xsd:string">found</RETURN_STRING>
</INFO>

from the response into "int" and "String", i need just an example, which
would push me forwards.

This is what I have done till now. What I can do is to transform the
document with xslt, but this is a SOAP, and I want to take this way.
I know, this has something to do with the ReturnType of the Document,
but what I have to set to gain it?

I'am using APACHE AXIS.

---- snip ----

public Document getDocument(String areacode, String street, String
house){

Document doc = null;

//PbLogger.log( " ************** DSLCHECK *************** " +
areacode + " " + street + " " + house );

try {

Object info = null;
Object result = null;

Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress( new java.net.URL( this.endpoint ) );
//call.setOperationName(new QName("http:\\dslcheck", "dslcheck"));
call.setOperationName(new QName("dslcheck"));
call.setOperationStyle("rpc");
call.setUsername(this.user);
call.setPassword(this.password);

call.addParameter("areacode", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("street", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("house", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_ANYTYPE );

Node node = ( Node ) call.invoke( new Object[] { areacode,
street, house } );

System.out.println( "Encoding Style" + call.getEncodingStyle() );

Node parentNode = node.getParentNode();
DomPrinter domPrinter = new DomPrinter();
domPrinter.printDOMTree( parentNode );

System.out.println("\n------------------------------\n");

Message message = call.getResponseMessage();
SOAPEnvelope soapEnvelope = message.getSOAPEnvelope();
Vector vc = soapEnvelope.getBodyElements();

for( int i = 0; i < vc.size() ; i++){
SOAPBodyElement sbe = (SOAPBodyElement) vc.elementAt(i);
doc = sbe.getAsDocument();

domPrinter.printDOMTree( doc );
}

} catch (Exception e) {
System.err.println(e.toString());
//PbLogger.logErr( "DslCheck:getDocument", e );
}

return doc;
}


---- snap ----



Thx.
atum
 
Joined
Feb 17, 2010
Messages
3
Reaction score
0
Use of Apache Axis

I want to generate the code from .XSD.Can Anybody tell me how to use Apache Axis for it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top