Could anyone post examples about sendingand receiving messages with SOAP

I am newbie, and want to learn SOAP. Anyone can tell me
where to find many examples about communication between client and server
based on SOAP. The example is in java code should be best.
Many thanks in advance

Java tutorial at http://java.sun.com/webservices/docs/ea1/tutorial/doc/JAXM.ws.html#63873
should be a good starting point.
I have sample code, which creates SOAP header and SOAP elements. THis code gives an idea to create SOAP messages and to parse the SOAP response. Hope this helps.
I pass Application ID and password in SOAP header, used by the Webservices provider to verify my application. In the SOAP elments, I pass a string (called ticket) and ip address. Web services provider will verify the string and return the response along with some attributes related to the user (extended attributes).
import javax.xml.soap.*;
import javax.xml.messaging.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import java.net.*;
import com.sun.net.ssl.internal.ssl.*;
public class AuthenticateTicket extends HttpServlet{
private static ServletConfig Config;
//always use this Name space
private static final String AUTH_WS_NS = "http://some.url.com/ws/";
// parameters to get the properties for AUTH
private static final String AUTH_LOGIN_URL = "http://some.url.com/loginpage/" + "?izAppId=AUTHappl";
private static final String AUTH_WS_URL ="http://some.url.com/loginpage/v4.asmx";
private static final String AUTH_CLIENT_APPL_ID = "AUTHappl";
private static final String AUTH_CLIENT_APPL_PSWD = "AUTHappl";
* init
* @param ServletConfig
* @return void
public void init(ServletConfig config) throws ServletException {
     Config = config;
* service
* This is where the servlet get invoked.
* @param HttpServletRequest
* @param HttpServletResponse
* @return void
* @throws ServletException
* @throws IOException
public void service(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {     
System.out.println("------- service() AuthenticateTicket -------");
     String host = request.getRemoteAddr();
     String izTicket = request.getParameter("izTicket");
     String izStatus = request.getParameter("izStatus");
if (host == null || host.equals("localhost") || izStatus == null || izStatus.trim().equals("") ) {
response.sendRedirect(AUTH_LOGIN_URL);
else if (izTicket != null){
          verifyAUTHTicket(host, izTicket);
          RequestDispatcher rd = request.getRequestDispatcher("/jspPage1");
          rd.forward(request, response);
          return;
     else {
          System.out.println (" NOOOOOOOOO TICKET ");
          RequestDispatcher rd = request.getRequestDispatcher("/jspPage1");
          rd.forward(request, response);
* <code>createSOAPMessage</code>
* Create the standard AUTH Soap Message.
* This is used during the verifySession process. It creates the message with
* the returnAllAttriutes = true;
* @param String host
* @param String ticketStr
* @return SOAPMessage
* @throws Exception
private static SOAPMessage createSOAPMessage(String host, String ticketStr) throws Exception{
MessageFactory msgFactory = MessageFactory.newInstance( );
SOAPMessage soapMessage = msgFactory.createMessage();
          soapMessage.saveChanges();
// Obtain references to the various parts of the message.
SOAPPart soapPart               = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope     = soapPart.getEnvelope();
SOAPBody soapBody               = soapEnvelope.getBody();
SOAPHeader header               = soapEnvelope.getHeader();
//********** HEADER PART **********
Name headerName = soapEnvelope.createName("wsConsumerCredential", "", AUTH_WS_NS);
          SOAPHeaderElement hdrElem = header.addHeaderElement(headerName);
Name authId = soapEnvelope.createName("id");
Name authPwd = soapEnvelope.createName("password");
SOAPElement idElem = hdrElem.addChildElement(authId);
          idElem.addTextNode(AUTH_CLIENT_APPL_ID);
SOAPElement pwdElem = hdrElem.addChildElement(authPwd);
          pwdElem.addTextNode(AUTH_CLIENT_APPL_PSWD);
//********** BODY PART **********
// Create the <VerifySession> body elements.
Name verifySess = soapEnvelope.createName("VerifySession", "",AUTH_WS_NS);
SOAPBodyElement verifySessBOS = soapBody.addBodyElement(verifySess);
// Create the child elements under the <VerifySession> elements.
Name ticket = soapEnvelope.createName("ticket");
Name userIP = soapEnvelope.createName("userIpAddr");
Name extendedAttr = soapEnvelope.createName("returnExtendedAttributes");
SOAPElement ticketBOS = verifySessBOS.addChildElement(ticket);
SOAPElement ipBOS = verifySessBOS.addChildElement(userIP);
SOAPElement exAttrBOS = verifySessBOS.addChildElement(extendedAttr);
//ticket string
ticketBOS.addTextNode(ticketStr);
ipBOS.addTextNode(host);
//boolean, do we want extended attr?
     exAttrBOS.addTextNode("true");
          soapMessage.saveChanges();      
soapMessage.writeTo(System.out);
return soapMessage;
* <code>parseSOAPResponse</code>
* Parse the standard AUTH Soap Response
* This is used to parse through the AUTH response to gather all the necessary user
* information.
* the returnAllAttriutes = true;
* @param SOAPMessage
* @return User
* @throws Exception
private static void parseSOAPResponse(SOAPMessage response) throws Exception{
String uid, firstName, lastName, email, bolID;
System.out.println (" ============ RESPONSE IS: ====================");
response.writeTo(System.out);
          SOAPPart sp = response.getSOAPPart();
SOAPEnvelope soapEnvelope = sp.getEnvelope();
SOAPBody sb = soapEnvelope.getBody();
Name cName = soapEnvelope.createName("VerifySessionResponse","", AUTH_WS_NS);
Iterator it = sb.getChildElements(cName);
SOAPBodyElement verifyResponse = (SOAPBodyElement)it.next();
//System.out.println(" got verifyResponse");
it = verifyResponse.getChildElements(); //iwsResponse
SOAPElement iwsResponse = (SOAPElement)it.next();
//System.out.println(" got iwsResponse");
cName = soapEnvelope.createName("action");
String actionStr = iwsResponse.getAttributeValue(cName);
cName = soapEnvelope.createName("hasErrors");
String hasErrorsStr = iwsResponse.getAttributeValue(cName);
          if (actionStr != null && actionStr.equals("Verify") && hasErrorsStr != null
          && hasErrorsStr.equals("false")) {
SOAPElement info = null;
cName = soapEnvelope.createName("sessionInfo","", AUTH_WS_NS);
info = (SOAPElement)iwsResponse.getChildElements(cName).next();
System.out.println (" name is: "+ info.getElementName().getLocalName() + "----" + info.toString());
cName = soapEnvelope.createName("status");
String status = info.getAttributeValue(cName);
System.out.println (" status : " + status) ;
          if (status == null || status.indexOf("Active") < 0)
               throw new Exception("Session not Active");
               SOAPElement userData = null;
cName = soapEnvelope.createName("userAttributes","", AUTH_WS_NS);
userData = (SOAPElement)info.getChildElements(cName).next();
System.out.println (" ===> got user Data ");
cName = soapEnvelope.createName("attribute","", AUTH_WS_NS);
it = userData.getChildElements(cName);
SOAPElement attr = null;
cName = soapEnvelope.createName("accounts","", AUTH_WS_NS);
userData = (SOAPElement)info.getChildElements(cName).next();
System.out.println (" ===> got user Account Data ");
cName = soapEnvelope.createName("account","", AUTH_WS_NS);
it = userData.getChildElements(cName);
SOAPElement account = null;
String loginIDStr=null, typeStr=null, statusStr=null;
while (it.hasNext()){
account = (SOAPElement) it.next();
cName = soapEnvelope.createName("loginId");
loginIDStr = account.getAttributeValue(cName);
cName = soapEnvelope.createName("type");
typeStr = account.getAttributeValue(cName);
cName = soapEnvelope.createName("status");
statusStr = account.getAttributeValue(cName);
     if (statusStr.equals("Authenticated")) {
          System.out.println("\n\nAuthentication successful");
     else {
          System.out.println("\n\nAuthentication failed");
* <code>verifyAUTHTicket</code>
* this is for verifySession call to AUTH; It controls the flow with AUTH.
* @param String host
* @param String ticketStr
* @return User
* @throws Exception
public static void verifyAUTHTicket(String host, String izticket) {
     SOAPConnection conn =null;
     try {
//Creat a message
          Provider provider = new Provider();
          java.security.Security.addProvider(provider);
SOAPMessage message = createSOAPMessage(host, izticket);
// Get a SOAP connection from the connection factory.
SOAPConnectionFactory connFactory = SOAPConnectionFactory.newInstance( );
// set the default security protocol (shipped with JSSE1.0.2)
          System.setProperty ("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
// add the default security provider (again, in JSSE1.0.2)
//          java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider() );
conn = connFactory.createConnection( );
// Define the message destination.
URLEndpoint destination = new URLEndpoint(AUTH_WS_URL);
// Send the message and wait for the response.
SOAPMessage response = conn.call( message, destination );
parseSOAPResponse(response);
} catch (Exception ex) {
ex.printStackTrace();
// Close the connection.
finally{
try{
if (conn != null){
conn.close();
catch (SOAPException se){
}

Similar Messages

  • "Error reconnecting to SBP-2 device"Could anyone post your suceessful print

    at /etc/modules
    options sbp2 serialize_io=1 exclusive_login=0
    linux1 (nod1 first boot)
    [root@linux1 ~]# dmesg | grep sbp2
    sbp2: $Rev: 1265 $ Ben Collins <[email protected]>
    ieee1394: sbp2: Maximum concurrent logins supported: 2
    ieee1394: sbp2: Number of active logins: 0
    ieee1394: sbp2: Logged into SBP-2 device
    ieee1394: sbp2: Error reconnecting to SBP-2 device - reconnect failed
    ieee1394: sbp2: Logged out of SBP-2 device
    ieee1394: sbp2: Maximum concurrent logins supported: 2
    ieee1394: sbp2: Number of active logins: 0
    ieee1394: sbp2: Logged into SBP-2 device
    linux2 (node2 second boot)
    [root@linux2 ~]# dmesg | grep sbp2
    sbp2: $Rev: 1265 $ Ben Collins <[email protected]>
    ieee1394: sbp2: Maximum concurrent logins supported: 2
    ieee1394: sbp2: Number of active logins: 1
    ieee1394: sbp2: Logged into SBP-2 device
    The 2nd boot server will alway kick out the 1st booted server from firewire
    connection.
    i try to use diffrent 1394 card , this issue still exist.
    Could anyone post your suceessful printout? ( both node status )
    Message was edited by:
    kook.liu
    Message was edited by:
    kook.liu

    My dmesg output looked exactly like yours and I was able to get a RAC up and running.
    I do not believe this is a problem as it worked for me with identical dmesg output.
    I think it means that the first node which was connected to the Firewire drive gets dis-connected when the second node tries to connect to it. That is why you get the "reconnect failed" message.
    After it fails to reconnect, it logs out of the device and then logs in again. If your device did not support concurrent logins, you would see a different error message in your dmesg output ("login failed").
    A simple way to check if the device is available to both nodes after booting is to run the fdisk -l command on both nodes. If you can see the device on both nodes in the fdisk output then it is available on both nodes.

  • HT3529 I am confused about messaging. Shouldn't I be able to send and receive messages with cellular data off?  I can usually send the message, but often do not receive messages until I either have wifi or turn cellular on.

    I am confused about messaging. Shouldn't I be able to send and receive messages with cellular data off and without wifi? I can send the message but often do not receive messages from others, iPhone or other, until  I turn on cellular or wifi.

    Depends on the type of Message.
    SMS messages will send and receive with data off.  and while you can guarantee you send using SMS you cannot guarantee that whoever replies to you does also. They may be replying thorugh iMessage if they are using iPhones.
    However Android should be sending through SMS.
    You can turn off iMessage if you want to, though people with limtied SMS text messaging in their plans may not appreciate it, and stop messaging you.

  • How to Post XML Messages with SOAP Headers to a Trading Partner URL

    Hi All,
    Greeting to the Oracle B2B Community. We are currently working on how to post a Custom XML Message with SOAP Headers to a Trading Partner URL. I would really appreciate if anybody could provide me some inputs or links to some documentation on how to achieve the above requirement. The details are below:
    1. Our Internal Application generates a Flat File (PO Extract).
    2. The Extract then needs to be transformed to an XML Message. We are planning to use BPEL to do the transformation to XML Message.
    3. Once it is transformed to an XML message it needs to be posted to the Trading Partner URL as an HTTP Post and with SOAP Headers.
    We are planning to use B2B to do the posting but I am not sure on how to do the set-ups and what all parameter files in B2B needs to be updated in order to achieve the same. Also it is mandatory that we send SOAP Headers in the XML Message.
    Thanks In Advance for your help.
    Regards,
    Dibya

    Hello Dibya,
    As you are already doing the transformation from Flat file to XML in BPEL which is typically the capability of B2B, please use the Soap binding in BPEL to send the document to Trading partner.
    Rgds,Ramesh

  • Received message with invalid client

    Logs on one Lion 10.7.5 machine are full of
    dscl[48193]: received message with invalid client_id 3
    The PID keeps incrementing but the client_id is always 3
    Googling mainly leads back to:
    https://discussions.apple.com/message/18643232?searchText=Received%20message%20w ith%20invalid%20client#18643232
    But this system isn't using LDAP.  I found one post that suggested stopping and restarting AFP, but:
    macbook:~ joliver$ sudo serveradmin stop afp
    afp:error = "CANNOT_LOAD_BUNDLE_ERR"
    macbook:~ joliver$ sudo serveradmin start afp
    afp:error = "CANNOT_LOAD_BUNDLE_ERR"
    Any ideas?

    You may find the solution here:
    https://discussions.apple.com/thread/3602806
    SQL

  • Message Bridge error "Received message with no URI property"

    I have created a message bridge between two weblogic JMS servers on different domains.
              Message bridge has source and destinations.
              I have tested each ques seperately with MDB deployed on each server.
              When i am putting message on source que then i am getting this error "Received message with no URI property"
              It would be grat help if some could tell me what might be going wrong.
              Thanks
              Akash

    Hi,
              This exception indicates a failure to establish a JNDI context for either the source or target destination host. Check if the the bridge's configured URLs for both are correct. I'm not 100% sure, but it is likely that no URL need be configured for destination's that are in the same cluster as the bridge.
              For more information, I suggest looking at the Messaging Bridge FAQ, which contains some troubleshooting tips. You can find a link to it here:
              http://dev2dev.bea.com/technologies/jms/index.jsp
              Tom Barnes, BEA

  • Is anyone else having trouble setting up messages with the new mountain lion software? I keep getting a notification that i cant sign in and it is saying, check network connection and try again, but i have full wifi bars, thanks, Justin

    is anyone else having trouble setting up messages with the new mountain lion software? I keep getting a notification that i cant sign in and it is saying, check network connection and try again, but i have full wifi bars, thanks, Justin

    Install this to get X11 functionality back in 10.8
    http://xquartz.macosforge.org/landing/
    Worked great for me and others.
    Jerry

  • Received message with invalid client_id

    I am running a Mac Mini Server with Mac OSX 10.7.3 Server and when I log in with a client (also a Mac Mini running Lion OSX 10.7.3) I see this in the system log. Everything is working fine but I don't understand why I recieve these messages.
    Feb 23 12:28:15 server AppleFileServer[558]: received message with invalid client_id 462
    Feb 23 12:28:15 server AppleFileServer[558]: received message with invalid client_id 463
    Feb 23 12:28:17 server AppleFileServer[558]: received message with invalid client_id 470
    Feb 23 12:28:17 server AppleFileServer[558]: received message with invalid client_id 471
    If I log in with an older Mac Mini running Snow Leopard I don't see these messages. I tried this with another Mac Mini running the same Lion 10.7.3 and I see the same messages (different id numbers).
    Anybody have an idea why this is happening?
    Thanks,
    Tony

    You may find the solution here:
    https://discussions.apple.com/thread/3602806
    SQL

  • Does anyone have Ford sync allowing text messaging with IOS 7.0.4?

    I had all the settings working when I was on ios 6, but now that I have upgraded it quit working.  I removed the sync from my phone and removed the phone from my phone from sync then paired again.  Then set the sync notifications back to on but still no text.  Does anyone have ford sync allowing text messaging with IOS 7.0.4?

    I need to update, my messaging is now working.  Apparently after going through the steps and the settng notifications to on all I had to do was turn off the car, open the door, and then return.  When I got in my car this morning the text messaging (recieve only) was working.

  • Why do I receive messages with only a date, no subject, no from, no body, etc.?

    at varying times I receive messages with a blank subject, no entry in [from, to] no body, but a date in 1969.
    Any ideas why I receive these?

    Thank you for your help.
    I tried emptying the inbox, deleting the 2 files, and restarting TB.
    I did the same for Sent and Trash.
    I also deleted all .msf files for all inbox sub-folders and for all folders and sub-folders under "My Mail".
    the problem persists.
    My inbox has many sub-folders and sub-sub-folders should those be moved to My Mail?
    Another problem I am having. I do not know if it is related.
    I have a stack of filters that move incoming mail into folders. The stack ends with 2 filters.
    (1) a filter that checks whether FROM is from someone in my mail lists. It then moves the message into a folder called "Known Sender".
    (2) a psuedo-ELSE filter that check whether the subject contains a very improbable string. It put the message in a folder called ") Suspicious".
    Sometimes I still end up with folders in Inbox that clearly should be in the two folders, "Known Sender" or ") Suspicious".

  • I can't send and receive message with my 3GS french iphone with the iOS5. What can I do?

    I have install the new iOS5 and now i can't send or receive message. What can i do to resolve this problem? Can I downgrade to the iOS 4.3.5 and where can i find the information to do that

    MacBook Pro
    https://discussions.apple.com/community/notebooks/macbook_pro 
    https://discussions.apple.com/community/mac_os 
    http://www.apple.com/support/macbookpro
    This is helpful Mail Setup Wizard:
    http://www.apple.com/support/mail
    This, is not forum for notebook owners.
    I would post in Mountain Lion : Mail

  • Problem receiving messages with Blackberry messenger

    I recently purchased the Blackberry 8130 Pearl.  While using the blackberry messenger I have an intermitant problem where I do not receive messages.  I have to remove the battery and restart the phone to receive the message.  Can anyone shed some light on this? 

       Y U No Help Me

  • B1iSN - sender and receiver message with different tesk

    Hi all,
    I have a question regarding the B1i.
    Is it possible to have the receiver will have a different task then the sender?
    My scenario is:
    The user creates a Delivery note in company "a",
    The B1i creates an Invoice from that Delivery Note in company "b".
    now I want to update the Delivery note with the DocEntry of the created Invoice.
    I copied all other fields to my receiver message.
    My problem is that I want on the event of "Create Invoice" in company "b" to update a Delivery note in company "a".
    I tried doing in 2 ways:
    one is in the xsl file I wrote the <QueryParams> element. Then I got this error: The business object already exists
    The second is without the <QueryParams> a new Invoice was created (but i wanted the existing one to be updated).
    Is it possible to do this in the B1i? How?
    Thanks in advance!
    Chana

    Hi Chana,
    Did you configured the biu to "Update on Exist"??? (Guide 03 Extensibility, section 2.14)
    You can have a look to the B1iSN 8.8 B12B1 Intercompany scenario in order to see how it is done (B1iSN 8.8 is already in GA). In that scenario the Subsidiary PO is updated with the number of the SO when the SO created by B1iSN in the Headquarters.
    Regards,
    Trinidad.

  • Is anyone having issues sending and receiving downloads with messages?

    I downloaded messages. But I'm having troubles sending and receiving downloads from others.
    My friend has messages as well and we can send small files, like mp3. But when I tried to send him a movie that's 500mb it says that the file is too big.
    When I get incoming files to download (doesn't matter if the file is small or large), I click it and my aim automatically logs me off and then back on. So I can't even accept incoming downloads. Anyone have any fixes?

    Hi,
    I have one other thread where the person says there Login to AIM gets booted off when they try to accept Files in Messages beta.
    Personally I have one Jabber Buddy who I cannot get Files from but they can send me AIM File Transfers.
    I need to test with other Jabber Buddies to check this further myself.  However I am not booted Off line.
    I have sent Picture files in line and as free standing File transfers over AIM before, the largest probably being about 50Mb at a max.
    I certainly have not sent a movie that big (I have sent smaller ones)
    I have not come across a Limit before.
    What do you see if you have the File Transfer window Open as well ?
    This tends to show the sideways barbershop pole and a second downward arrow to start the download from there.
    Mine fails when I click the arrow in the File Transfer window and until then it says Waiting.
    The other thread has also tried Auto Accept with no luck.
    At present I have not answers to this.
    We have not tried Zipped files in the other thread.
    9:53 PM      Thursday; May 31, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.4)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.7.4),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Could anyone please help about print check??

    Dear expert,
    We are testing the print process in  OEM sample company but it did not print out and show that "The print document could not be started?" I have no clue how to solve this problem. The printer can print anything except this check, we are new to SAP and will go live very soon. Please help if you could. Thanks a lot.

    Mickey usually the standard for processing a check in not to use the check for payment area, thats more for manual checks or viewing a check already posted.
    My suggestion is to go to the outgoing payments area and select what you are going to pay using this area, post this..
    then go to the document printing under Banking, change the document type to checks for payment
    select the checks you want to print and enter your starting ck number...
    send this to the printer of choice, wait until all checks print and then confirm
    Hope this helps
    ps also make sure you have the default layout for the check listed in Admin, set up, banks, house banks...scroll to the right and see the defaults to set up.
    Edited by: Joanne Pencola on Sep 28, 2011 1:53 PM

Maybe you are looking for

  • HELP: failed to deploy and run WL performance monitor, console extension

    Hi All i downloaded and installed the WL performance monitor, console extension package at http://commerce.bea.com/products/weblogicserverconsoleextension/wlsext_home.jsp As i tried to deploy "performance monitor" web app to the WL server at "Perform

  • IPad 2 mic no longer working

    My iPad 2 mic doesn't seem to be working.  It has worked the first few times I used it, but now can't record audio for garage band, nor can my FaceTime send any audio.  Help

  • Saving with serializing

    so im starting java. but i have had some and i mean some work in C++ and Visual Basic (1 year combined in highschool) and before anyone asks yes i am a highschool student. So dont jump on my case, im just trying to learn. Ok so here's my problem. I n

  • High Availability for SAProuter

    Dear all Is it possible to create a high available SAProuter somehow. We currently have two instances which have load balancing. However, if one goes down, all connections from that are lost since SAProuter hold these in memory. Any advice or tips ar

  • ImportError: No module named rhpl.translate

    Hi, I am trying to setup RPM repository. The job seems to have failed at the last step. Step: DownloadAdvisories (Failed)           Traceback (most recent call last): File "/<path>/emagent/gcagent/em_staging/dwldAdvisories.py", line 4, in <module> fr