Web Security Lab Ex2
Web Security Lab Ex2
This study source was downloaded by 100000832295719 from CourseHero.com on 08-29-2022 08:52:48 GMT -05:00
https://www.coursehero.com/file/73848000/18bcs8004-ex2pdf/
Create new web-service:
"http://localhost:8080/wasp/uddi/inquiry/";
private static final String DEFAULT_DATA_FILENAME = "./Default.xml";
// In the SOAP chapter, we used "urn:oreilly:jaws:samples",
// butSystinet UDDI requires this to be blank.
private static final String URI = "";
This study source was downloaded by 100000832295719 from CourseHero.com on 08-29-2022 08:52:48 GMT -05:00
https://www.coursehero.com/file/73848000/18bcs8004-ex2pdf/
private String m_hostURL;
private String m_dataFileName;
publicUDDISoapClient(String hostURL, String dataFileName) throws Exception
{
m_hostURL = hostURL;
m_dataFileName = dataFileName;
System.out.println( );
System.out.println(" ");
System.out.println("Starting UDDISoapClient:");
System.out.println(" host url = " + m_hostURL);
System.out.println(" data file = " + m_dataFileName);
System.out.println(" ");
System.out.println( );
}
public void sendSOAPMessage( ) {
try {
// Get soap body to include in the SOAP envelope from FILE FileReaderfr = new FileReader
(m_dataFileName); javax.xml.parsers.DocumentBuilderxdb =
org.apache.soap.util.xml.XMLParserUtils.getXMLDocBuilder( ); org.w3c.dom.Document doc
=xdb.parse (new org.xml.sax.InputSource (fr));
if (doc == null) {
throw new org.apache.soap.SOAPException
(org.apache.soap.Constants.FAULT_CODE_CLIENT, "parsing error");
}
// Create a vector for collecting the body elements Vector bodyElements = new Vector( );
// Parse XML element as soap body element bodyElements.add(doc.getDocumentElement ( ));
// Create the SOAP envelope
org.apache.soap.Envelope envelope = new org.apache.soap.Envelope( );
envelope.declareNamespace("idoox", "http://idoox.com/uddiface"); envelope.declareNamespace("ua",
"http://idoox.com/uddiface/account"); envelope.declareNamespace("config",
"http://idoox.com/uddiface/config");
This study source was downloaded by 100000832295719 from CourseHero.com on 08-29-2022 08:52:48 GMT -05:00
https://www.coursehero.com/file/73848000/18bcs8004-ex2pdf/
envelope.declareNamespace("attr", "http://idoox.com/uddiface/attr");
envelope.declareNamespace("fxml", "http://idoox.com/uddiface/formxml");
envelope.declareNamespace("inner", "http://idoox.com/uddiface/inner");
envelope.declareNamespace("", "http://idoox.com/uddiface/inner");
envelope.declareNamespace("uddi", "urn:uddi-org:api_v2");
//
// NO SOAP HEADER ELEMENT AS SYSTINET WASP DOES NOT REQUIRE IT
//
// Create the SOAP body element
org.apache.soap.Body body = new org.apache.soap.Body( );
body.setBodyEntries(bodyElements); envelope.setBody(body);
// Build and send the Message. org.apache.soap.messaging.Messagemsg =
neworg.apache.soap.messaging.Message( );
msg.send (new java.net.URL(m_hostURL), URI, envelope); System.out.println("Sent SOAP
Message with Apache HTTP SOAP Client.");
// Receive response from the transport and dump it to the screen System.out.println("Waiting
for response. "); org.apache.soap.transport.SOAPTransportst = msg.getSOAPTransport (
);
BufferedReaderbr = st.receive ( );
if(line == null) {
System.out.println("HTTP POST was unsuccessful. \n");
} else {
while (line != null) { System.out.println (line); line = br.readLine( );
}
}
/////
// Version in examples has XML pretty printing logic here.
////
} catch(Exception e) {
e.printStackTrace( );
}
https://www.coursehero.com/file/73848000/18bcs8004-ex2pdf/
This study source was downloaded by 100000832295719 from CourseHero.com on 08-29-2022 08:52:48 GMT -05:00
https://www.coursehero.com/file/73848000/18bcs8004-ex2pdf/
}
//
// NOTE: the remainder of this deals with reading arguments
//
/** Main program entry point. */
public static void main(String args[]) {
// Not Relevant
}
}
This study source was downloaded by 100000832295719 from CourseHero.com on 08-29-2022 08:52:48 GMT -05:00
https://www.coursehero.com/file/73848000/18bcs8004-ex2pdf/