custom header elements soap messages

P

plork

Please can someone help me

I've partly created a handler, code below

I want to simply test this with a client that can add a soap header, can
someone show me how to do this?

I'm not sure how to create a client

I then need to be able to pass vlaues back to the server-side from the
client-side =- how can i do this?

Do i need to write a wsdd file?

Any help reatly appreciated

i'm using eclipse ide and apache axis


public void invoke(MessageContext msgContext) throws AxisFault
{
handleRequest(msgContext);
super.invoke(msgContext);
}


public boolean handleResponse(MessageContext msgContext)
{
try
{
Message message = msgContext.getRequestMessage();
SOAPEnvelope requestEnvelope = message.getSOAPEnvelope();
SOAPHeaderElement headerElement =
requestEnvelope.getHeaderByName("http://domain","TokenHeader");

if (headerElement != null)
{
String headerElementValue =
(String)headerElement.getValue();

// make sure the headerElementValue is valid
validateTokenValue(headerElementValue);
}
else
{
// something's gone wrong

// no header TokenHeader found, therefore we need to create
a header element and return to client

// get userName and password
// pass to db to validate

//SOAPHeaderElement responseHeaderElement = new
SOAPHeaderElement("http://domain","TokenHeader");
//responseHeaderElement.setObjectValue(sTokenValue);
}
}
catch(Exception e)
{
System.out.println(e);
}

return true;
}


public boolean handleRequest(MessageContext msgContext)
{
try
{
//SOAPEnvelope responseEnvelope =
msgContext.getResponseMessage().getSOAPEnvelope();
Message message = msgContext.getResponseMessage();
SOAPEnvelope responseEnvelope = message.getSOAPEnvelope();

}
catch(Exception e)
{
System.out.println(e);
}

return true;
}
 

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