Can't create SOAP body

I've taken the schema for SOAP and can create an envelope, a header and a body
with no data content. But now I can't add content; I can't create put anything
in the body.
It appears you can only set a Body with a Body object, but I want to put my XML/string
into the body. Seems easy in theory, but I can't figure out how to do it. I tried
parsing the content using a BodyDocument, but that created a fragment and I got
weird errors:
XmlValueNotNillableException
or
Tree copy contents NYI
Help!
Ken.

I think all my problems were because I had old xmlBeans and interfaces. Simple
set() methods worked, but any attempt to set a complex type failed. I just recompiled
my schemas and tried again and it worked. The new beans have addNewXXX() methods;
the old beans had ensureXXX() methods. Now I'm cooking with gas. ;->
Ken.
"Ken Kress" <[email protected]> wrote:
>
Eric,
Samir passed along the suggestion to call the addBody method, but
there is no such method in the soap interfaces I have.
I got the schema for SOAP from: http://www.w3.org/2001/09/soap-envelope
and compiled it. The interfaces the Body portion only list Factory methods
of
newInstance, parse, load, newValidatingXMLInputStream and coerce.
The envelope has ensureBody and setBody methods, but I haven't figured
how how
to use them. For instance, if I do this:
envelope.ensureHeader();
Body tmpBody = envelope.ensureBody();
// add the Body
envelope.setBody( tmpBody );
I get:
Exception in thread "main" java.lang.RuntimeException: Tree copy contents
NYI
at com.bea.xbean.values.XmlObjectBase.set(XmlObjectBase.java:1480)
at com.bea.xbean.schema.ComplexTypeMethodHandler.invoke(ComplexTypeMetho
dHandler.java:512)
at com.bea.xbean.schema.SchemaTypeImpl.executeComplexTypeMethod(SchemaTy
peImpl.java:1552)
at com.bea.xbean.values.XmlObjectBase.invoke(XmlObjectBase.java:1030)
at $Proxy1.setBody(Unknown Source)
at MMIMain2.buildEnvelope(MMIMain2.java:129)
at MMIMain2.printLogonRequest(MMIMain2.java:89)
at MMIMain2.main(MMIMain2.java:70)
The same thing happens if I try to create my own body and then use setBody.
Ken.
"Eric Vasilik" <[email protected]> wrote:
Sounds like you may want to use XmlCursor. If you get the XmlObject
corresponding
to the body, call newCursor(). This will return an XmlCursor whichcan
be positioned
insode the body (it is initiall positioned just outside the body). Then,
create
another cursor on the content you want to place inside the body andcall
move()
or copy() on the source cursor, passing the destination cursor. This
will move/copy
the stuff you want in the body to the body.
"Ken Kress" <[email protected]> wrote:
I've taken the schema for SOAP and can create an envelope, a headerand
a body
with no data content. But now I can't add content; I can't create put
anything
in the body.
It appears you can only set a Body with a Body object, but I want to
put my XML/string
into the body. Seems easy in theory, but I can't figure out how to
do
it. I tried
parsing the content using a BodyDocument, but that created a fragment
and I got
weird errors:
XmlValueNotNillableException
or
Tree copy contents NYI
Help!
Ken.

Similar Messages

  • BUG 1.5 : Can't create package body.

    I'm getting this stack dump in the console trying to create a package body.
    I'm logged in as a dba.
    executed 'alter session set current schema=x';
    created package in the worksheet.
    opened package from Other users|x|packages.
    Edited and compiled package.
    Tried to create body from connection tree context menu.
    I have both viewer and edit window open on the package. The stack dump occurs regardless of which one had focus before I go to the tree to create the body.
    Exception while performing action Create Body
    java.lang.IllegalStateException: Not in compound edit
            at oracle.javatools.buffer.AbstractTextBuffer.endEdit(AbstractTextBuffer.java:1126)
            at oracle.ide.model.TextNode$FacadeTextBuffer.endEdit(TextNode.java:1074)
            at oracle.dbtools.raptor.dialogs.actions.CreateBodyAction.launch(CreateBodyAction.java:94)
            at oracle.dbtools.raptor.controls.sqldialog.ObjectActionController.handleEvent(ObjectActionController.java:140)
            at oracle.ide.controller.IdeAction.performAction(IdeAction.java:524)
            at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:855)
            at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:496)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
            at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
            at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
            at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
            at java.awt.Component.processMouseEvent(Component.java:5488)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
            at java.awt.Component.processEvent(Component.java:5253)
            at java.awt.Container.processEvent(Container.java:1966)
            at java.awt.Component.dispatchEventImpl(Component.java:3955)
            at java.awt.Container.dispatchEventImpl(Container.java:2024)
            at java.awt.Component.dispatchEvent(Component.java:3803)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
            at java.awt.Container.dispatchEventImpl(Container.java:2010)
            at java.awt.Window.dispatchEventImpl(Window.java:1774)
            at java.awt.Component.dispatchEvent(Component.java:3803)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

    This has been fixed for the patch release 1.5.1.
    Sue

  • How can I create a body section to be scrolled  using a scroll bar ?...

    Hi there...
    Using Dreamweaver, I have a button link to show all the recently events covered by our services.
    I would like to use a section in that page called "events" with some pictures and text  rolling up, as soon there is more text included.
    This is the best way I can put some new events  occurred as my reference, Is possible to do that in Dreamweaver, or there is any
    other tool I could us for that ?
    Please, let me know.
    Gustavo Hevia

    Hi -
    Use CSS overflow property
    Use the "Try it yourself" button for demo

  • How to create a SOAP body based on a Serializable Object?

    Hello,
    I have a serializable object such as this one
            HeaderSection header = new HeaderSection();
            RequestName requestName = new RequestName();
            requestName.setActivityName("this is an activity");
            NNSVMessage nnsvMessage = new NNSVMessage();
            nnsvMessage.setHeaderSection(header);
            nnsvMessage.setRequestSection(request);
            nnsvMessage.setResponseSection(response);I create a SOAP message using SAAJ API
            SOAPMessage message = messageFactory.createMessage();
            SOAPPart soapPart = message.getSOAPPart();
            SOAPEnvelope envelope = soapPart.getEnvelope();
            SOAPBody body = envelope.getBody();
    ...How can I stuff this object into the SOAP body?
    Thanks,
    Mustafa

    Hi Saleem,
    Herewith an example:
            Dim oDoc As SAPbobsCOM.Documents
            oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
            oDoc.CardCode = "530010"
            oDoc.DocDate = Date.Now
            oDoc.DocDueDate = Date.Now
            oDoc.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service
            oDoc.Lines.ItemDescription = "Line 1"
            oDoc.Lines.Price = 100
            oDoc.Lines.VatGroup = "O1"
            oDoc.Lines.AccountCode = "0000090000"
            oDoc.Lines.Add()
            oDoc.Lines.ItemDescription = "Line 2"
            oDoc.Lines.Price = 200
            oDoc.Lines.VatGroup = "O1"
            oDoc.Lines.AccountCode = "0000090201"
            If oDoc.Add <> 0 Then
                MessageBox.Show(oCompany.GetLastErrorDescription)
            Else
                MessageBox.Show("Added")
            End If
    Hope it helps,
    Adele

  • Can SOAP body have multiple immediate children without splitting the msg

    We have a vendor we need to send a SOAP message to, but they require the SOAP body have two different immediate children.  In graphical mapping this doesn't seem to be possible. 
    If we create separate external definitions for each, then they would become separate target messages once added to a message mapping.  If we try to combine the XSDs into one, import it as an external definition, and add it to the mapping, It prompts us to choose one of the elements of the external def from the top level.  The only way to choose a second is to add another, which again results it two separate target messages.
    Is our vendor's request compliant with W3C standards?  If so, is this just a limitation of graphical mapping and what are the most common workarounds in PI?

    >>If we create the SOAP envelope with our mapping, then does that affect the ability to use the SOAP adapter to provide a digital signature?
    This is what I would do. Consider synchronous scenario. If you sign the message digitally and send it to system A (say outbound)  and you need to have the same soap message structure (inbound)  during signature verification. Otherwise signature verification process will fail.
    Do as follow
    Outbound
    A) First mapping: Adding soap envelope  using (XSLT mapping) or java mapping or any way
    B) Second mapping: Signing the message using digital signature via java mapping
    Inbound
    First mapping should be digital signature verify using java mapping
    if the requirement to remove/modify saop envelope on the inbound side or any changes in structure only after the signature verification

  • Can I create a SOAP message object from a string?

    can i create a soap message object in saaj with a string containing soap xml?
    I know messageFactory has a constructor that
    public abstract SOAPMessage createMessage(MimeHeaders headers, InputStream in)
    does anyone know how to use this? Specifically transform a SOAP message in string format to something i could pass this constructor.
    Is there a better way to do this?
    I'm not EVER going to use apache's tomcat or GLUE or anyting and need to send a soap message from a client to a server via SOAP. I need to be able to transfer a String SOAP document to something i can search for elements with.

    sorry for being critical but the tutorial you just linked to is for the most part USELESS. it doesnt deal with Java just what a SOAP message looks like. yeah, i get it, its like xml. now how do i do what i want to with saaj?
    something like
    String sm;
    sm = in.readLine(); //gives me a whole SOAP document (pretend)
    sm--->>>MAGIC------>>>>>MIMEHeaders headers & InputStream sm_in
    MessageFactory factory = MessageFactory.newInstance();
    SOAPMessage message = factory.createMessage(headers, sm_in);
    SOAPBody soapBody = message.getSOAPBody();
    Name bodyName = factory.createName("YUP","m","http://theinternet/YUP");
    Iterator iterator = soapBody.getChildElements(bodyName);
    SOAPBodyElement bodyElement = (SOAPBodyElement)iterator.next();
    String yup = bodyElement.getValue();
    System.out.println("YUP element of the SOAP document is " + yup);what is the MAGIC in the above code?

  • How to create soap envelope structure

    Hello Friends,
    I am working on a RFC to webservice sync scenario.Here I am getting response from webservice in soap envelope form which is not matching with my wsdl response structure. I have tried to create the envelope structure manually  but i dint get success. Can any body guide me how to over come with it.
    (I have already checked 'Do not create soap envelop' in receiver soap addapter).
    Regards,
    jayesh.

    Thanks Anupam and Jenny for your kind response.
    I am wrking on PI 7.0. I dnt want soap envelope in payload so I have already checked the 'Do not create response' button still in response message I am getting the soap envelope.
    I can use java or xslt but the the structure is not able to read the soap envelope. To read it I need to create same data structure which matches with the soap envelope.
    this is the response I am getting through webservice.
    <?xml version="1.0" encoding="UTF-8" ?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <createResponse>
    <result>
    <errors>
    <message>Config Master Record Type Name value is missing</message>
    <statusCode>FIELD_CUSTOM_VALIDATION_EXCEPTION</statusCode>
    </errors>
    <id xsi:nil="true" />
    <success>false</success>
    </result>
    </createResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    And this is the wsdl structure
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:createResponse xmlns:ns0="urn:enterprise.soap.sforce.com">
       <ns0:result>
          <ns0:errors>
             <ns0:fields/>
             <ns0:message/>
             <ns0:statusCode/>
          </ns0:errors>
          <ns0:id/>
          <ns0:success/>
       </ns0:result>
    </ns0:createResponse>
    Because of the soap envelope it is not able to read it. I have to create new structure.
    Experts please help me to solve this problem.
    Regards,
    Jayesh.

  • How To Create SOAP Envelop For WSDL

    Hi Friends,
    I have created one  webservice WSDL and i want to create SOAP Envelop for this.
    Can any one help me out how to create SOAP Envelop based on WSDL.
    ***************My WSDL***********************************
    <?xml version="1.0" encoding="UTF-8" ?>
    - <!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.
    -->
    - <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.
    -->
    - <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://annotation/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://annotation/" name="MyCompanyWS">
    - <types>
    - <xsd:schema>
    <xsd:import namespace="http://annotation/" schemaLocation="http://localhost:7101/WebService-Annotation-context-root/MyCompanyPort?xsd=1" />
    </xsd:schema>
    </types>
    - <message name="setMyDepts">
    <part name="parameters" element="tns:setMyDepts" />
    </message>
    - <message name="setMyDeptsResponse">
    <part name="parameters" element="tns:setMyDeptsResponse" />
    </message>
    - <message name="getMyDepts">
    <part name="parameters" element="tns:getMyDepts" />
    </message>
    - <message name="getMyDeptsResponse">
    <part name="parameters" element="tns:getMyDeptsResponse" />
    </message>
    - <message name="addEmployeeToDept">
    <part name="parameters" element="tns:addEmployeeToDept" />
    </message>
    - <message name="addEmployeeToDeptResponse">
    <part name="parameters" element="tns:addEmployeeToDeptResponse" />
    </message>
    - <message name="getDeptInfo">
    <part name="parameters" element="tns:getDeptInfo" />
    </message>
    - <message name="getDeptInfoResponse">
    <part name="parameters" element="tns:getDeptInfoResponse" />
    </message>
    - <portType name="MyCompany">
    - <operation name="setMyDepts">
    <input message="tns:setMyDepts" />
    <output message="tns:setMyDeptsResponse" />
    </operation>
    - <operation name="getMyDepts">
    <input message="tns:getMyDepts" />
    <output message="tns:getMyDeptsResponse" />
    </operation>
    - <operation name="addEmployeeToDept">
    <input message="tns:addEmployeeToDept" />
    <output message="tns:addEmployeeToDeptResponse" />
    </operation>
    - <operation name="getDeptInfo">
    <input message="tns:getDeptInfo" />
    <output message="tns:getDeptInfoResponse" />
    </operation>
    </portType>
    - <binding name="MyCompanyPortBinding" type="tns:MyCompany">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="" />
    - <operation name="setMyDepts">
    <soap:operation soapAction="" />
    - <input>
    <soap:body use="literal" />
    </input>
    - <output>
    <soap:body use="literal" />
    </output>
    </operation>
    - <operation name="getMyDepts">
    <soap:operation soapAction="" />
    - <input>
    <soap:body use="literal" />
    </input>
    - <output>
    <soap:body use="literal" />
    </output>
    </operation>
    - <operation name="addEmployeeToDept">
    <soap:operation soapAction="" />
    - <input>
    <soap:body use="literal" />
    </input>
    - <output>
    <soap:body use="literal" />
    </output>
    </operation>
    - <operation name="getDeptInfo">
    <soap:operation soapAction="" />
    - <input>
    <soap:body use="literal" />
    </input>
    - <output>
    <soap:body use="literal" />
    </output>
    </operation>
    </binding>
    - <service name="MyCompanyWS">
    - <port name="MyCompanyPort" binding="tns:MyCompanyPortBinding">
    <soap:address location="http://localhost:7101/WebService-Annotation-context-root/MyCompanyPort" />
    </port>
    </service>
    </definitions>
    Thanks in Advance.
    Bachan
    Edited by: Bachan on Sep 1, 2010 9:04 PM

    Thanks Sam,
    SOAP UI saved my life but that want last long.
    But still my issue is not resolved.
    I am using a plsql program to take the Values from SOAP envelop and pass it to web-service and get the responce.
    I am sure my approach is perfectly fine. because it is working fine with other examples, but mean while i have a WSDL link this is really big and my program is not working for this WSDL link.
    infact i am getting the output as the same XML of URL.
    Let me know if u can help me out.
    Thanks
    Bachan.

  • SOAP body and XML

    Hi,
    how can I get the body content of SOAP messages in XML format?
    I have a service that get as input a XML string, I want to create a Web Service, with this service, without change all but I have not understand how take the XML to give it to the old service.
    TIA
    Aslas

    You should check out the following in details. It
    explains to you how soap works and how you can
    implement a listener to retrieve the XML doc in
    the body.
    http://xml.apache.org/soap/docs/index.html
    Amlan

  • Create soap request with class "csoapdocument"

    Hi,
    i want to create a soap request with class "csoapdocument".
    The request looks like:
         <SOAP-ENV:Body>
            <m:SearchRequest xmlns:m="https://abcdefg">          
              <Root>
                     <MetaData>
                   <SourceID>ID1</SourceID>
                   <FName>sitris_request</FName>
                   <DataType>text/xml</DataType>
                     </MetaData>
                    <Data>
                   <DATA1>
                        <Req Id="1234">                                   <NUMBER>12345678</NUMBER>
                   </DATA1>
                    </Data>
                            </Root>                    
              </m:SearchRequest>
         </SOAP-ENV:Body>
    Is it possible to create this request with method add_parameter of class csoapdocument?
    Thanks

    Solved myself.
    The above soap reqeust can be created with set_body_from_fragment.

  • JAXB XML output as SOAP Body

    Hey,
    I currently have a psuedo webservice that pulls a string out of an http request and returns a corresponding xml document (based on a schema) to the caller. Pretty basic and it works fine. I use JAXB for the Marshalling of my objects to xml, based on the schema, so I know that my xml document is correct (well-formed and valid).
    Now, I would like to do the same thing, except as a SOAP-RPC call. I figure, for the service side, I can just wrap what I already generate in a SOAP Envelope, in response to a SOAP request. Creating the client is easy but I am having trouble with the client side. How can I simply pass an xml document as the SOAP body using Axis/JAX-RPC or whatever, instead of re-mapping to Java object, which might not guarantee the response document conforms to my schema?
    I've looked at SAAJ for this a bit, but this seems more about sending a message to a service rather than creating a response from a service....
    Any ideas?
    Mike

    Yes, it's been ten months, but have you figured out how to integrate SOAP and JAXB? I am attempting to make my SOAP client application code easy for a Java beginner to understand, so JAXB would be ideal.

  • Can't Create Bean Error

    I modified the numguess example that comes with tomcat but I get a "can't create bean" error message when I call my jsp file. If anyone can see what I'm doing wrong or suggest ways to discover the problem I'd appreciate it.
    My modified jsp:
    <!--
    Copyright (c) 1999 The Apache Software Foundation. All rights
    reserved.
    Number Guess Game
    Written by Jason Hunter, CTO, K&A Software
    http://www.servlets.com
    -->
    <%@ page import = "num.NumberGuessBean" %>
    <jsp:useBean id="numguess" class="num.NumberGuessBean" scope="session"/>
    <jsp:setProperty name="numguess" property="*"/>
    <html>
    <head><title>Number Guess</title></head>
    <body bgcolor="white">
    <font size=4>
    <% if (numguess.getSuccess()) { %>
    Congratulations! You got it.
    And after just <%= numguess.getNumGuesses() %> tries.<p>
    <% numguess.reset(); %>
    Care to try again?
    <% } else if (numguess.getNumGuesses() == 0) { %>
    Welcome to the Number Guess game.<p>
    Play with default limits ( a number between 0 and 100)<p>
    or enter upper and lower limits.<p>
    <form method=get>
    Play with defaults?: <input type=radio name=default value="yes">Yes
    <input type=radio name=default value="no">No
    <\form>
    <% if (numguess.getRadio().equals("no")) { %>
    <form method=get>
    Enter upper limit:<input type=text name=upperLimit>
    Enter lower limit:<input type=text name=lowerLimit>
    <\form>
    <% numguess.reset(); %>
    <% } %>
    <form method=get>
    What's your guess? <input type=text name=guess>
    <input type=submit value="Submit">
    </form>
    <% } else { %>
    Good guess, but nope. Try <b><%= numguess.getHint() %></b>.
    You have made <%= numguess.getNumGuesses() %> guesses.<p>
    I'm thinking of a number between <jsp:getProperty name="numguess" property="lowerLimit"/> and <jsp:getProperty name="numguess" property="upperLimit"/>.<p>
    <form method=get>
    What's your guess? <input type=text name=guess>
    <input type=submit value="Submit">
    </form>
    <% } %>
    </font>
    </body>
    </html>
    and the modified bean:
    * ====================================================================
    * The Apache Software License, Version 1.1
    * Copyright (c) 1999 The Apache Software Foundation. All rights
    * reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in
    * the documentation and/or other materials provided with the
    * distribution.
    * 3. The end-user documentation included with the redistribution, if
    * any, must include the following acknowlegement:
    * "This product includes software developed by the
    * Apache Software Foundation (http://www.apache.org/)."
    * Alternately, this acknowlegement may appear in the software itself,
    * if and wherever such third-party acknowlegements normally appear.
    * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
    * Foundation" must not be used to endorse or promote products derived
    * from this software without prior written permission. For written
    * permission, please contact [email protected].
    * 5. Products derived from this software may not be called "Apache"
    * nor may "Apache" appear in their names without prior written
    * permission of the Apache Group.
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation. For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    * Originally written by Jason Hunter, http://www.servlets.com.
    package num;
    import java.util.*;
    public class NumberGuessBean {
    int answer;
    boolean success;
    String hint;
    int numGuesses;
    String radiochoice;
    int lowerLimit=0;
    int upperLimit=100;
    String error;
    public NumberGuessBean() {
    reset();
    public void setGuess(String guess) {
    numGuesses++;
    int g;
    try {
    g = Integer.parseInt(guess);
    catch (NumberFormatException e) {
    g = -1;
    if (g == answer) {
    success = true;
    else if (g == -1) {
    hint = "a number next time";
    else if (g < answer) {
    hint = "higher";
    else if (g > answer) {
    hint = "lower";
    public void setRadio(String s) {
         radiochoice=s;
    public String getRadio() {
         return radiochoice;
    public void setLowerLimit( int lowerLimit) {
         this.lowerLimit=lowerLimit;
    public int getLowerLimit() {
         return lowerLimit;
    public void setUpperLimit(int upperLimit) {
         this.upperLimit=upperLimit;
    public int getUpperLimit() {
         return upperLimit;
    public boolean getSuccess() {
    return success;
    public String getHint() {
    return "" + hint;
    public String getError() {
         return ""+error;
    public int getNumGuesses() {
    return numGuesses;
    public void reset() {
         if (getRadio().equals("yes")) {
              answer = (int)(Math.random()*100);
         else {
              int i;
              i=(int)(Math.random()*upperLimit);
              if (i<lowerLimit) {
                   i=i+lowerLimit;
              answer=i;
         success = false;
    numGuesses = 0;

    implement synchronizable and createa constructor, then check it once again.

  • How can i create datasource on apache server for ADF application?

    Hi All,
    i my use case i have created simple adf application using ADF BC and want to deploy on Apache server 6.x.
    So my question is that  how can i create Data Source i have goggling and find  two different way to do this.
    1. write following line of code on apache server conf/Context.xml file.
    <Resource name="jdbc/TestDB" auth="Container"
                  type="javax.sql.DataSource"
                   driverClassName="oracle.jdbc.OracleDriver"
                  url="jdbc:oracle:thin:@localhost:dst"
                  username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"
                  maxWait="-1"/>
    but when i have used this way i got following exception.
    org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
    check link-
    https://forums.oracle.com/thread/2564233
    2. write following line of code apache conf/Server.xml file
    <GlobalNamingResources>
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users
        -->
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved"
                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                  pathname="conf/tomcat-users.xml" />
    <Resource name="jdbc/TestDB" auth="Container"
                  type="oracle.jdbc.pool.OracleDataSource"
                  description="User database that can be updated and saved"
                  driverClassName="oracle.jdbc.driver.OracleDriver"
                  factory="oracle.jdbc.pool.OracleDataSourceFactory"
                  url="jdbc:oracle:thin:@//172.31.43.207:1521:dst"
                  username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"
                  maxWait="-1"   />
      </GlobalNamingResources>
    and add this line in context.xml file inside <context> tag
    <ResourceLink global="jdbc/TestDB" name="jdbc/TestDB" type="oracle.jdbc.pool.OracleDataSource"/>
    but when i have run application i have got following error
    log-
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: invalid arguments in call"
      at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:298)
      at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:181)
      at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(test_jsp.java:110)
      at org.apache.jsp.test_jsp._jspService(test_jsp.java:63)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
      at java.lang.Thread.run(Thread.java:662)
    Aug 2, 2013 5:17:21 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: invalid arguments in call"
      at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:298)
      at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:181)
      at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(test_jsp.java:110)
      at org.apache.jsp.test_jsp._jspService(test_jsp.java:63)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
      at java.lang.Thread.run(Thread.java:662)
    so what is the solution how to create datasource on apche server which suitable for adf application?
    when i test data source using  following code used 1. way as i mentioned above  its running fine bt not for second.
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <sql:query var="rs" dataSource="jdbc/TestDB">
    select empname from pay_emphdr where empcd='JK1306'
    </sql:query>
    <html>
      <head>
        <title>DB Test</title>
      </head>
      <body>
      <h2>Results</h2>
    <c:forEach var="row" items="${rs.rows}">
        Foo ${row.empname}<br/>
    </c:forEach>
      </body>
    </html>
    please help me. it is very urgent.
    thanks in Advance
    Manish

    Hi Lindalnci
    i have already tried  this tutorial and in my post i have defined first way to do using this procedure.
    in that case i have got following exception as i have mentioned above
    org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection

  • How can i create a new item in the app "health"?

    how can i create a new item in the app "health"? I need a field for documentation of "Waist-to-height ratio", exactly for "circumference".
    It's a matter of common knowledge, that the Waist-to-height ratio (WHtR) has more significance then the Body-Mass-Index (BMI).

    If you mean you want to change a color of a calendar category or create a new one, you cannot do that, what is pre-loaded is what you get and cannot be edited.

  • WTK22 JSR172Demo - missing SOAP body

    Hi,
    I tried the sample JSR172Demo provided with WTK22, with the server running on localhost. Hence the WSDL port is as below:
    location="http://localhost:8080/serverscript2/serverscript"
    The service has been verified to be running. The stubs for the client generated using the KToolbar stub generator tool. The build was successful. However when the client is run and the service is invoked the following error is displayed on the Ktoolbar console:
    java.rmi.MarshalException: Missing SOAP Body or Envelope
         at example.serverscript.connector.Interface_Stub.request(+125)
         at example.serverscript.demo.Demo.run(+23)
    Please let me know if anyone has faced a similar problem and found a solution.
    Thanks,

    I have simular problem:
    "Missing SOAP Body or Envelope exception" when I'm trying to call web-service methos through internet.
    It seems there is something wrong with my computer security settings - can't imagine what's wrong.
    With local web-server everything works fine.
    I tryed to change Security Domain to Trusted, but this doesn't helps.
    Regards

Maybe you are looking for