Error to generate webservice from java file with JAXWS

I need to build a webservice to run on Glassfish, but I have problems, I did downloaded the latest JAX-WS recently(2 days).
I have the follow class to generate a wsdl file:
package com.dudhoo.farmacopedia.web;
import com.dudhoo.farmacopedia.web.hibernate.FarmacopediaKey;
import com.dudhoo.farmacopedia.web.key.KeyGenerator;
import java.util.Calendar;
import java.util.Date;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(serviceName="FarmacoWebService", name="nomeservice")  
public class FarmacoWebService {
    public FarmacoWebService() {
    @WebMethod()
    public Date getServerTime(){
        return Calendar.getInstance().getTime();
    public FarmacopediaKey generateSerial(Date ini, int dias){
        return new KeyGenerator().generateKey(ini, dias);
}I have the follow ant code:
<?xml version="1.0" encoding="windows-1252" ?>
<!--Ant buildfile generated by Oracle JDeveloper 10g-->
<!--Generated 01/08/2006 22:56:00-->
<project name="FarmacoWeb" default="all" basedir=".">
  <property file="build.properties"/>
  <path id="classpath">
    <fileset dir="../libs/" includes="**/*.jar"/>   
  </path>
  <path id="jaxws.classpath">
    <fileset dir="../libs/jaxws" includes="**/*.jar"/>   
  </path>
  <target name="init">
    <tstamp/>
    <mkdir dir="${output.dir}"/>
    <mkdir dir="${output.dir}/new"/>
    <mkdir dir="${output.dir}/res"/>
  </target>
  <target name="all" description="Build the project" depends="compile,copy"/>
  <target name="clean" description="Clean the project">
    <delete includeemptydirs="true" quiet="true">
      <fileset dir="${output.dir}" includes="**/*"/>
    </delete>
  </target>
  <target name="compile" description="Compile Java source files" depends="init">
    <javac destdir="${output.dir}" classpathref="classpath"
           debug="${javac.debug}" nowarn="${javac.nowarn}"
           deprecation="${javac.deprecation}" encoding="Cp1252" source="1.5"
           target="1.5">
      <src path="src"/>
    </javac>
  </target>
  <target name="copy" description="Copy files to output directory"
          depends="init">
    <patternset id="copy.patterns">
      <include name="**/*.gif"/>
      <include name="**/*.GIF"/>
      <include name="**/*.jpg"/>
      <include name="**/*.JPG"/>
      <include name="**/*.jpeg"/>
      <include name="**/*.JPEG"/>
      <include name="**/*.png"/>
      <include name="**/*.PNG"/>
      <include name="**/*.properties"/>
      <include name="**/*.xml"/>
      <include name="**/*-apf.xml"/>
      <include name="**/*.ejx"/>
      <include name="**/*.xcfg"/>
      <include name="**/*.cpx"/>
      <include name="**/*.dcx"/>
      <include name="**/*.wsdl"/>
      <include name="**/*.ini"/>
      <include name="**/*.tld"/>
      <include name="**/*.tag"/>
    </patternset>
    <copy todir="${output.dir}">
      <fileset dir="src">
        <patternset refid="copy.patterns"/>
      </fileset>
    </copy>
  </target>
  <target name="-pre-dist" >
        <taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
            <classpath refid="classpath"/>
        </taskdef>
        <wsgen
            debug="true"
            keep="true"
            destdir="${output.dir}/new"
            resourcedestdir="${output.dir}/res"
            sei="com.dudhoo.farmacopedia.web.FarmacoWebService">
            <classpath>
                <pathelement path="${jaxws.classpath}"/>
                <pathelement location="${output.dir}"/>               
            </classpath>
        </wsgen>
    </target>
</project>When I run ant the the follow error is throwed:
Buildfile: /home/duduzera/jdevhome/mywork/Farmaco/FarmacoWeb/build.xml
-pre-dist:
    [wsgen] Problem encountered during annotation processing;
    [wsgen] see stacktrace below for more information.
    [wsgen] java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z
    [wsgen]      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.hasWebMethods(WebServiceVisitor.java:373)
    [wsgen]      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:349)
    [wsgen]      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:143)
    [wsgen]      at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
    [wsgen]      at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:345)
    [wsgen]      at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:230)
    [wsgen]      at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
    [wsgen]      at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
    [wsgen]      at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:448)
    [wsgen]      at com.sun.tools.apt.main.Main.compile(Main.java:1075)
    [wsgen]      at com.sun.tools.apt.main.Main.compile(Main.java:938)
    [wsgen]      at com.sun.tools.apt.Main.processing(Main.java:95)
    [wsgen]      at com.sun.tools.apt.Main.process(Main.java:85)
    [wsgen]      at com.sun.tools.apt.Main.process(Main.java:67)
    [wsgen]      at com.sun.tools.ws.wscompile.CompileTool.buildModel(CompileTool.java:603)
    [wsgen]      at com.sun.tools.ws.wscompile.CompileTool.run(CompileTool.java:536)
    [wsgen]      at com.sun.tools.ws.util.ToolBase.run(ToolBase.java:54)
    [wsgen]      at com.sun.tools.ws.ant.WsGen.execute(WsGen.java:457)
    [wsgen]      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    [wsgen]      at org.apache.tools.ant.Task.perform(Task.java:364)
    [wsgen]      at org.apache.tools.ant.Target.execute(Target.java:341)
    [wsgen]      at org.apache.tools.ant.Target.performTasks(Target.java:369)
    [wsgen]      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    [wsgen]      at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    [wsgen]      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    [wsgen]      at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    [wsgen]      at oracle.jdevimpl.ant.runner.AntLauncher.launch(AntLauncher.java:321)
    [wsgen]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [wsgen]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [wsgen]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [wsgen]      at java.lang.reflect.Method.invoke(Method.java:585)
    [wsgen]      at oracle.jdevimpl.ant.runner.InProcessAntStarter.runAnt(InProcessAntStarter.java:293)
    [wsgen]      at oracle.jdevimpl.ant.runner.InProcessAntStarter.mav$runAnt(InProcessAntStarter.java)
    [wsgen]      at oracle.jdevimpl.ant.runner.InProcessAntStarter$1.run(InProcessAntStarter.java:71)
    [wsgen] error: compilation failed, errors should have been reported
    [wsgen]
BUILD SUCCESSFUL
Total time: 3 secondsI'm using JDeveloper 10g. Did someone had problems like this?
I think the problem maybe is caused by jar lib concurrences...
thanks

You get that error when response headers have already been sent to the client (browser). This can happen in two ways that I know of:
- you flushed data to the client, or somewhere the data was automatically flushed
- you already did a redirect/forward and are attempting to do a second one.
So if you want to prevent yourself from getting the error, you'll need to make sure that neither of the situations has occurred. Don't output content unless you are absolutely certain that you won't need to foward/redirect later and don't do a redirect/forward twice in the same resource.

Similar Messages

  • Jdeveloper 11.1.1.0.0 - Error when generating webservice from Collection or

    Hello.
    I get the error when I like to publish a method which return a Collection..
    for example I have a Class:
    package in2;
    import java.sql.Connection;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.*;
    import javax.jws.WebMethod;
    import javax.jws.WebService;
    public class servis {
        public servis() {
        public String hello() {
            return "PETER";
        public Collection vrniPodatke() {
            Collection l = new ArrayList();
            l.add ( new OptionList("PTER","VALENCIC"));
            return l;
        public int sestej (int a , int b) {
            return a+b;
    ==========
    package in2;
        public class OptionList {
            String a;
            String b;
            public OptionList(String a, String b) {
                this.a = a;
                this.b = b;
            public void setA(String newa) {
                this.a = newa;
            public String getA() {
                return a;
            public void setB(String newb) {
                this.b = newb;
            public String getB() {
                return b;
        }The error I get is:
    java.lang.RuntimeException: Cannot find namespace for: ns1
         at oracle.j2ee.ws.wsdl.extensions.oracle.schema.BaseSchemaElement.getQNameFromValue(BaseSchemaElement.java:185)
         at oracle.j2ee.ws.wsdl.extensions.oracle.schema.BaseSchemaElement.getAttributeValueAsQNameOrNull(BaseSchemaElement.java:173)
         at oracle.j2ee.ws.wsdl.extensions.oracle.schema.ElementSchemaElement.getTypeAsQName(ElementSchemaElement.java:63)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.SchemaValidator.validate(SchemaValidator.java:145)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.SchemaValidator.validateSequence(SchemaValidator.java:414)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.SchemaValidator.validateComplexType(SchemaValidator.java:224)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.SchemaValidator.validate(SchemaValidator.java:157)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validateElement(WSDLValidator.java:709)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validateParts(WSDLValidator.java:667)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validateMessage(WSDLValidator.java:644)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validateOutput(WSDLValidator.java:604)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validateOperations(WSDLValidator.java:596)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validatePortType(WSDLValidator.java:585)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validateDefinition(WSDLValidator.java:97)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLValidator.validate(WSDLValidator.java:68)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:247)
         at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:171)
         at oracle.j2ee.ws.common.processor.Processor.runModeler(Processor.java:73)
         at oracle.j2ee.ws.tools.wsa.AssemblerTool.run(AssemblerTool.java:126)
         at oracle.j2ee.ws.tools.wsa.WsdlToJavaTool.createModel(WsdlToJavaTool.java:471)
         at oracle.j2ee.ws.tools.wsa.Util.createDeploymentDescriptors(Util.java:913)
         at oracle.jdeveloper.webservices.model.generator.GenerateDescriptors.action(GenerateDescriptors.java:146)
         at oracle.jdeveloper.webservices.model.java.generator.JavaEjbGenerateDescriptors.action(JavaEjbGenerateDescriptors.java:78)
         at oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAction.java:151)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:525)
         at java.awt.Dialog$2.run(Dialog.java:553)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Dialog.java:551)
         at java.awt.Component.show(Component.java:1300)
         at java.awt.Component.setVisible(Component.java:1253)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:358)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:222)
         at oracle.ide.dialogs.ProgressBar.start(ProgressBar.java:194)
         at oracle.jdeveloper.webservices.model.Model.saveEditSync(Model.java:226)
         at oracle.jdevimpl.webservices.wizard.jaxrpc.WebServicesEditor.showDialog(WebServicesEditor.java:296)
         at oracle.jdevimpl.webservices.WebServicesAddin.findAndInvokeWizard(WebServicesAddin.java:1408)
         at oracle.jdevimpl.webservices.WebServicesAddin.handleEvent(WebServicesAddin.java:837)
         at oracle.ide.controller.IdeAction.performAction(IdeAction.java:506)
         at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:779)
         at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:479)
         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:5501)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
         at java.awt.Component.processEvent(Component.java:5266)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3968)
         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:1778)
         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)
    ======================
    What I'am doing wrong?

    I don't know what is happening with Jdeveloper ?!?!
    I have tryed the same example at home with Jdeveloper 11.1.1.0.0 Build JDEVADF_MAIN.DROP5_GENERIC_071218.2321.4796
    All works fine.....
    What you think could be wrong (in my first post)? Why I have received the error? and why the same project works on other computer?
    can someone reply to my post?

  • B1WS - (401)Unauthorized Error while accessing Webservice from JAVA

    Hi,
    While accessing B1WS getting the following error.
    Please help us to resolve the error
    {http://xml.apache.org/axis/}HttpErrorCode:401
    (401)Unauthorized
        at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    Here is the Code :
    public class Test {
    //     public static final java.lang.String _dst_MSSQL2008 = "dst_MSSQL2008";
         public static final LoginDatabaseType dst_MSSQL2008 = new LoginDatabaseType("dst_MSSQL2008");
         public static final LoginLanguage ln_English = new LoginLanguage("ln_English");
        public static void main(String[] arg) throws ServiceException, IOException
            LoginServiceSoapStub login = (LoginServiceSoapStub) new LoginServiceLocator().getLoginServiceSoap(new URL("http://10.10.5.115/sapb1web/WebReferences/LoginService.wsdl"));
        try {
            login.login("ESPL-LAP-048", "INDIAHEAD", dst_MSSQL2008,"manager", "12345", ln_English, "ESPL-LAP-048:30000");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            System.out.println("Error "+e.getMessage());
    Thanks
    Ravi Shankar

    Hi,
    Not sure this is right forum to post. You may try post in SDK forum to get quick response.
    Thanks & Regards,
    Nagarajan

  • Geeting error while consuming webservice from java

    Issue description :
    We are tried to connect to clients SAP bapi web service with Apache Axis tool  ( version- axis2-1.5) and SOAP UI tool (SOAPUI3.6.1
    )  , we faced following error : and getting following login error failed error from SAP.
    Error :
    HTTP 401 - Unauthorized. Login failed. The application was running in the system QAS
    It is really starange as , using the id i could log in to the system , but while consuming the service , for the same id it is giving this error.
    Regards,
    Ranjit

    Hi,
    Not sure this is right forum to post. You may try post in SDK forum to get quick response.
    Thanks & Regards,
    Nagarajan

  • Forward error to other jsp from .java file

    Hi all
    i have simple app
    html with log in (username and passwor) and submit button
    when the user click submit after he put his username and passwor the servelet will call loginHandler
    now in logInHandler will forward to welcom.jsp if login and passwor are correct
    but if not
    will catch login exception
    how can i forward to error.jsp ?
    if i try to change the forward page<response.sendRedirect("/WEB-INF/pages/error.jsp")>;
    i got this error
    "Cannot forward after response has been committed"

    You get that error when response headers have already been sent to the client (browser). This can happen in two ways that I know of:
    - you flushed data to the client, or somewhere the data was automatically flushed
    - you already did a redirect/forward and are attempting to do a second one.
    So if you want to prevent yourself from getting the error, you'll need to make sure that neither of the situations has occurred. Don't output content unless you are absolutely certain that you won't need to foward/redirect later and don't do a redirect/forward twice in the same resource.

  • BUG: error rebuilding SQLJ files along other java files with generic

    I have done a rebuild on a package containing some SQLJ files, and (consistently) got the following error:
    C:\TeleMessage\trunk\src\telemessage\db\impl\dbAdmin.sqlj
        Error(44,18): Java Parsing. Encountered: <
        Expected: <IDENTIFIER> ...; "[" ...; The error at the cursor in the given file is not possible, since there was no '<' there, and besides - if I non-aggresively changed the file, e.g. narrowed imports, changed whitespace or added comments - the error remained in the same location.
    I went and done a search using regex in the package, for a line starting with 17 chars followed by a '<'.
    I found it in one of the normal JAVA files (not-SQLJ), at line 44 (surprise!) - in a Java 5 generics declaration, e.g. Map<String,Integer>. the 18th character was indeed the '<'.
    I'm guessing that the SQLJ translator (accidentally?) parses non-SQLJ files.
    If this cannot be fixed, it is really bad - it is one thing that JDeveloper cannot support Java 5 language features because of its dependancy in the SQLJ translator (which is not known to be upgraded until version 11g if at all), but the inability to compile SQLJ files in a project containing other non-SQLJ java files with Java 5 features is hard.
    I could only workaround this by rebuilding SQLJ files one at a time!
    I also have another type of error, when rebuilding the same project in a higher-level pacakge (root or "Application Sources"):
    C:\TeleMessage\trunk\src\dbtools\CallbackNumberFiller.sqlj
        Error(24,8): Missing semicolon.
        Error(24,8): Unbalanced curly braces.Again, the specified file could not be the one to blame - the location of the error is in the middle of the public modified keyword in a method declaration; nothing is neither missing nor unbalanced.
    This appears to be different, as it pops in the log near the end of the build process, when the JSPs are being built, specfically during the time the message log fills with "writing <...>" lines (after "translating <...>" and "compiling <...>".
    I can consistently reproduce both cases - please advise how I can help you find out what causes this.
    Regards,
    Yaniv Kunda

    First of all, this bug not JDeveloper's problem, but the SQLJ team's.
    You can read more posts about this:
    Re: BUG: Cannot translate SQLJ files with Java5 generics code
    Re: How to use SQLJ with Java 1.4 and 1.5?
    Re: SQLJ discontinued??
    And if we're at it, this is strange - I can't seem to find the oracle doc you quoted...
    SQLJ 11g? The latest release is a part of JPublisher 10.2 available from
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
    I also didn't find anything on google on 11g, nor about the part number you specified.
    Didn't find any Java 1.5 supporting SQLJ translators from other vendors as well.
    Do you have any link to this statement?
    But if we examine this bug again, the problem involves JDeveloper passing Java 5 featured JAVA files to the SQLJ translator.
    Isn't there a way to instruct the translator to use CLASS files compiled by a normal Java 5 compiler, instead of trying to compile the files itself?
    Regards,
    Yaniv Kunda

  • Calling SAP Webservice from JAVA ME bad response time

    Hello together,
    I'm calling a SAP RFC as a Webservice from JAVA ME (Netbeans 6.8). The stub classes I've generated with the Sun Wireless Toolkit. The RFC function stores entries in a SAP database table. The call of the websevice with transmitting the data and the database update in SAP works fine, but I got the response message from SAP with a delay of 40 seconds.
    Does anyone know why there is so a long delay in the response and how to fix it?

    hi,
    is this reproducible or was it just the first call to that service?
    it usually occurs that once you call a webservice for the first time, some of the programs (be it your application programs or the even the SOAP runtime itself) required have not been compiled until that and so they are compiled during the webservice call.
    This leads to slow response times even time-outs. The effect vanishes once all sources are compiled (i.e. depending on the complexity of your calls after one to a few calls to that service).
    So, if the slow response times persist, you should turn on debugging in SICF and see where time is spent...
    my 2 cents,
    anton

  • Calling secured webservice from java

    Hi Experts,
    I am trying to call a secured webservice from java.
    I got the code to call a non secured web service in java.
    What changes do i need to do in this to call a secured webservice.
    Please help me.
    Thank you
    Regards
    Gayaz
    calling unsecured webservice
    package wscall1;
    import java.io.BufferedReader;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.StringBufferInputStream;
    import java.io.StringReader;
    import java.io.StringWriter;
    import java.io.Writer;
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    import java.security.Permission;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.ParserConfigurationException;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    import org.w3c.css.sac.InputSource;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class WSCall2 {
    public WSCall2() {
    super();
    public static void main(String[] args) {
    try {
    WSCall2 ss = new WSCall2();
    System.out.println(ss.getWeather("Atlanta"));
    } catch (Exception e) {
    e.printStackTrace();
    public String getWeather(String city) throws MalformedURLException, IOException {
    //Code to make a webservice HTTP request
    String responseString = "";
    String outputString = "";
    String wsURL = "https://ewm52rdv:25100/Saws/SawsService";
    URL url = new URL(wsURL);
    URLConnection connection = url.openConnection();
    HttpURLConnection httpConn = (HttpURLConnection)connection;
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    //Permission p= httpConn.getPermission();
    String xmlInput =
    "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://www.ventyx.com/ServiceSuite\">\n" +
    " <soapenv:Header>\n" +
    "     <soapenv:Security>\n" +
    " <soapenv:UsernameToken>\n" +
    " <soapenv:Username>sawsuser</soapenv:Username>\n" +
    " <soapenv:Password>sawsuser1</soapenv:Password>\n" +
    " </soapenv:UsernameToken>\n" +
    " </soapenv:Security>" + "</soapenv:Header>" + " <soapenv:Body>\n" +
    " <ser:GetUser>\n" +
    " <request><![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
                "                        <GetUser xmlns=\"http://www.ventyx.com/ServiceSuite\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
                "                        <UserId>rs24363t</UserId>\n" +
                "                        </GetUser>]]>\n" +
    " </request>\n" +
    " </ser:GetUser>\n" +
    " </soapenv:Body>\n" +
    "</soapenv:Envelope>";
    byte[] buffer = new byte[xmlInput.length()];
    buffer = xmlInput.getBytes();
    bout.write(buffer);
    byte[] b = bout.toByteArray();
    String SOAPAction = "GetUser";
    // Set the appropriate HTTP parameters.
    httpConn.setRequestProperty("Content-Length", String.valueOf(b.length));
    httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
    httpConn.setRequestProperty("SOAPAction", SOAPAction);
    // System.out.println( "opening service for [" + httpConn.getURL() + "]" );
    httpConn.setRequestMethod("POST");
    httpConn.setDoOutput(true);
    httpConn.setDoInput(true);
    OutputStream out = httpConn.getOutputStream();
    //Write the content of the request to the outputstream of the HTTP Connection.
    out.write(b);
    out.close();
    //Ready with sending the request.
    //Read the response.
    InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
    BufferedReader in = new BufferedReader(isr);
    //Write the SOAP message response to a String.
    while ((responseString = in.readLine()) != null) {
    outputString = outputString + responseString;
    //Parse the String output to a org.w3c.dom.Document and be able to reach every node with the org.w3c.dom API.
    Document document = parseXmlFile(outputString);
    NodeList nodeLst = document.getElementsByTagName("User");
    String weatherResult = nodeLst.item(0).getTextContent();
    System.out.println("Weather: " + weatherResult);
    //Write the SOAP message formatted to the console.
    String formattedSOAPResponse = formatXML(outputString);
    System.out.println(formattedSOAPResponse);
    return weatherResult;
    public String formatXML(String unformattedXml) {
    try {
    Document document = parseXmlFile(unformattedXml);
    OutputFormat format = new OutputFormat(document);
    format.setIndenting(true);
    format.setIndent(3);
    format.setOmitXMLDeclaration(true);
    Writer out = new StringWriter();
    XMLSerializer serializer = new XMLSerializer(out, format);
    serializer.serialize(document);
    return out.toString();
    } catch (IOException e) {
    throw new RuntimeException(e);
    private Document parseXmlFile(String in) {
    try {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource is = new InputSource(new StringReader(in));
    InputStream ins = new StringBufferInputStream(in);
    return db.parse(ins);
    } catch (ParserConfigurationException e) {
    throw new RuntimeException(e);
    } catch (SAXException e) {
    throw new RuntimeException(e);
    } catch (IOException e) {
    throw new RuntimeException(e);
    } catch (Exception e) {
    throw new RuntimeException(e);
    static {
    javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
    public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
    if (hostname.equals("ewm52rdv")) {
    return true;
    return false;
    }

    Gayaz  wrote:
    What we are trying is we are invoking webservice by passing SOAP request and we will get soap response back.I understand what you're trying to do, the problem is with tools you're using it will take a while for you do anything a little away from the trivial... Using string concatenation and URL connection and HTTP post to call webservices is like to use a hand drill... It may work well to go through soft wood, but it will take a lot of effort against a concrete wall...
    JAX-WS and JAXB and annotations will do everything for you in a couple of lines and IMHO you will take longer to figure out how to do everything by hand than to learn those technologies... they are standard java, no need to add any additional jars...
    That's my thought, hope it helps...
    Cheers,
    Vlad

  • How to call webservice from Java application

    Hi XI gurus
    Pls let me know how to call a webservice from Java application.
    I wanted to build synchronous interface from Java Application to SAP using SAP XI
    For example, i need to create Material master from Java application and the return message from SAP, should be seen in Java application
    Regards
    MD

    Hi,
    If your  JAVA Application is Web based application, you can expose it as Webservice.
    JAVA People will pick the data from Dbase using their application and will send the data to XI by using our XI Details like Message Interface and Data type structure and all.
    So we can Use SOAP Adapter or HTTP in XI..
    If you use HTTP for sending the data to XI means there is no need of Adapter also. why because HTTP sits on ABAP Stack and can directly communicate with the XI Integration Server Directly
    If you are dealing with the Webservice and SAP Applications means check this
    Walkthrough - SOAP  XI  RFC/BAPI
    REgards
    Seshagiri

  • How to generate a second csv file with different report columns selected?

    Hi. Everybody:
    How to generate a second csv file with different report columns selected?
    The first csv file is easy (report attributes -> report export -> enable CSV output Yes). However, our users demand 2 csv files with different report columns selected to meet their different needs.
    (The users don't want to have one csv file with all report columns included. They just want to get whatever they need directly, no extra columns)
    Thank you for any help!
    MZ

    Hello,
    I'm doing it usually. Typically example would be in the report only the column "FIRST_NAME" and "LAST_NAME" displayed whereas
    in the csv exported with the UTL_FILE the complete address (street, housenumber, additions, zip, town, state ... ) is written, these things are needed e.g. the form letters.
    You do not need another page, just an additional button named e.g. "export_to_csv" on your report page.
    The csv export itself is handled from a plsql procedure "stored procedure" ( I like to have business logic outside of apex) which is invoked by pressing the button "export_to_csv". Of course the stored procedure can handle also parameters
    An example code would be something like
    PROCEDURE srn_brief_mitglieder (
         p_start_mg_nr IN NUMBER,
         p_ende_mg_nr IN NUMBER
    AS
    export_file          UTL_FILE.FILE_TYPE;
    l_line               VARCHAR2(20000);
    l_lfd               NUMBER;
    l_dateiname          VARCHAR2(100);
    l_datum               VARCHAR2(20);
    l_hilfe               VARCHAR2(20);
    CURSOR c1 IS
    SELECT
    MG_NR
    ,TO_CHAR(MG_BEITRITT,'dd.mm.yyyy') AS MG_BEITRITT ,TO_CHAR(MG_AUFNAHME,'dd.mm.yyyy') AS MG_AUFNAHME
    ,MG_ANREDE ,MG_TITEL ,MG_NACHNAME ,MG_VORNAME
    ,MG_STRASSE ,MG_HNR ,MG_ZUSATZ ,MG_PLZ ,MG_ORT
    FROM MITGLIEDER
    WHERE MG_NR >= p_start_mg_nr
    AND MG_NR <= p_ende_mg_nr
    --WHERE ROWNUM < 10
    ORDER BY MG_NR;
    BEGIN
    SELECT TO_CHAR(SYSDATE, 'yyyy_mm_dd' ) INTO l_datum FROM DUAL;
    SELECT TO_CHAR(SYSDATE, 'hh24miss' ) INTO l_hilfe FROM DUAL;
    l_datum := l_datum||'_'||l_hilfe;
    --DBMS_OUTPUT.PUT_LINE ( l_datum);
    l_dateiname := 'SRNBRIEF_MITGLIEDER_'||l_datum||'.CSV';
    --DBMS_OUTPUT.PUT_LINE ( l_dateiname);
    export_file := UTL_FILE.FOPEN('EXPORTDIR', l_dateiname, 'W');
    l_line := '';
    --HEADER
    l_line := '"NR"|"BEITRITT"|"AUFNAHME"|"ANREDE"|"TITEL"|"NACHNAME"|"VORNAME"';
    l_line := l_line||'|"STRASSE"|"HNR"|"ZUSATZ"|"PLZ"|"ORT"';
         UTL_FILE.PUT_LINE(export_file, l_line);
    FOR rec IN c1
    LOOP
         l_line :=  '"'||rec.MG_NR||'"';     
         l_line := l_line||'|"'||rec.MG_BEITRITT||'"|"' ||rec.MG_AUFNAHME||'"';
         l_line := l_line||'|"'||rec.MG_ANREDE||'"|"'||rec.MG_TITEL||'"|"'||rec.MG_NACHNAME||'"|"'||rec.MG_VORNAME||'"';     
         l_line := l_line||'|"'||rec.MG_STRASSE||'"|"'||rec.MG_HNR||'"|"'||rec.MG_ZUSATZ||'"|"'||rec.MG_PLZ||'"|"'||rec.MG_ORT||'"';          
    --     DBMS_OUTPUT.PUT_LINE (l_line);
    -- in datei schreiben
         UTL_FILE.PUT_LINE(export_file, l_line);
    END LOOP;
    UTL_FILE.FCLOSE(export_file);
    END srn_brief_mitglieder;Edited by: wucis on Nov 6, 2011 9:09 AM

  • How to extract data from XML file with JavaScript

    HI All
    I am new to this group.
    Can anybody help me regarding XML.
    I want to know How to extract data from XML file with JavaScript.
    And also how to use API for XML
    regards
    Nagaraju

    This is a Java forum.
    JavaScript is something entirely different than Java, even though the names are similar.
    Try another website with forums about JavaScript.
    For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3

  • Get 'Generic Error' when attempting to import .mov files with transparency?

    I get the 'Generic Error' when attempting to import .mov files with transparency? I'm trying to use mattes with an alpha channel but I cannot import them. I have had this same issue since cs6, now I have it with cc 2014? Any clues would be most appreciated.
    I have uninstalled the DVCPro Codec, but it didn't help.
    I have tried converting the .mov file (which is now automatic in Yosemite) and this creates a ProRes4444 Codec, Again no luck with import.
    I've seen this issue on the web, but never a solution? Anyone?

    Hi Terence,
    I tried iPhoto Library Manager but it could not solve my problem. Opening the iPhoto library I can see that the reference to the pictures are pointing to my old location not to the new one. I considered running a script that would change all pointers since this is basically what is needed (in my case from /Volumes/RAID1/Fotos/XXX to /Volumes/Fotos/XXX). Instead I inserted a soft unix link to make to connection but that did not work. It is referring to the airport disk by the airport name rather than the mounted disk name. Very strange indeed. The problem is maybe not in iPhoto but in OSX? Anyway, maybe the only way out is to take some hours and manually run through all linked photos... cumbersome and annoying!
    Regards,
    Søren

  • Convert from java file to cap file

    Dear Pro,
    Please help me this problem,
    I'm building a applet in eclipse. Now, I want to convert from java file to cap file to load it into javacard.
    I need repair what tools and do what, please help me!
    Thanks & Best Regards,
    KeillyNguyen

    Run -> Run Configuration -> Double click Java Card Application -> Click Run
    After that, the CAP file will be generated in the bin directory.
    Are you come from VN? Im Vietnamese :) Nice to meet you

  • Error when generating IDoc from MC document - workitem to all the SAP users

    A workflow item with the subject of “Error when generating IDoc from MC document” is sent to all the SAP users' inbox. Is it possible to stop the generation of this work item? If that is not possible, can we limit sending the work item to a specific user/agent instead of all the users in the system?
    It appears that these work item or error message are generated when one of the developers reopen the POs and add line items. Moreover, during that time the procurement team blocked the IDOCs from going out to the vendors when changing and resaving the POs. Therefore, we need stop the generation of error message/work item when the IDOCs generation blocked.

    Please check Rule 70000141which is the default rule for this task. Inside this rule a FM is attcahed which is reading table EDO13 and EDPP1 where agent is retrieved Probably this table entries are not maintained. This Workflow is getting triggered from Message cOntrol I think.
    Please check this link for
    http://help.sap.com/saphelp_47x200/helpdata/en/c5/e4aec8453d11d189430000e829fbbd/frameset.htm
    <b>Reward points if useful and close thread if resolved</b>

  • Associating .java files with JDeveloper in Windows

    Is there some mechanism via by which I can load a .java file in a currently instance of JDeveloper (905p) on Windows (2K) from the command line?
    I want to be able to associate .java files with JDeveloper with appropriate actions defined, so that when I double-click on a .java file in Windows Explorer, it gets opened up in the currently running JDeveloper instance ... rather than opening a new instance of JDeveloper?
    Thanks

    Hi,
    There's no easy way to do this at the moment. However, in the 10g production release, functionality has been added to associate .java files (and other artefacts e.g. .jpr files) with JDeveloper.
    Thanks,
    Brian
    JDev Team

Maybe you are looking for

  • 8 GB Nano vs 30 GB Video Ipod

    These are the same price. I'm trying to decide which to purchase. Are their any reasons other than size that I would choose the Nano over the Video Ipod with lots of storage?   Windows XP  

  • Iphone 6 rotation issue...

    Basically dropped my phone a couple of times, also spilt water on it...both in the same night...water didnt appear to penetrate the phone but for some reason i can now only view things in landscape that have landscape capability...ie messages, photo'

  • Recharged my iPad and it shows iTunes and a plug?

    Recharged my iPad and the screen shows iTunes and a plug.

  • Placing Image in Background

    Hi, When any report (in 11G) returns no data, I want to configure a custom message with an image in background. Is it possible to achieve this? How? I tried customizing class error text in 'views.css' but it did not help, I must be missing something.

  • ID picks CMYK colors as RGB

    Hello The problem is: when I try to pick a CMYK color in InDesign, it immediately switches it to RGB. The method I pick the color doesn't matter, even if I pick my color from the swatches (C0, M0, Y0, K100), the object is colored with something like