Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2005, 05:50 AM
Registered User
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default java axis web service

i have written java client with a call object.
i have to invoke a .net web service.
the code i tried with as follows:
<%@ page import="org.apache.axis.client.Call" %>
<%@ page import="org.apache.axis.client.Service" %>
<%@ page import="org.apache.axis.encoding.XMLType" %>
<%@ page import="org.apache.axis.utils.Options" %>
<%@ page import="javax.xml.namespace.QName" %>
<%@ page import="javax.xml.rpc.ParameterMode" %>
<%@ page import="java.net.URL" %>
<%@ page import="org.apache.axis.client.Call" %>
<%@ page import="org.apache.axis.client.Service" %>
<%@ page import="javax.xml.namespace.QName" %>
<%@ page import="java.net.*" %>
<%


Service service = new Service();
Call call = (Call) service.createCall();

String endpoint = "http://172.16.0.21/WebService1/Service1.asmx?WSDL";
call.setProperty(call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(call.SOAPACTION_URI_PROPERTY,"htt p://tempuri.org/WebService1");

//call.addParameter("A",org.apache.axis.encoding.XML Type.XSD_FLOAT,javax.xml.rpc.ParameterMode.IN);
//call.addParameter("B",org.apache.axis.encoding.XML Type.XSD_FLOAT,javax.xml.rpc.ParameterMode.IN);

call.setReturnType(XMLType.XSD_FLOAT);

call.setTargetEndpointAddress(new URL(endpoint));

call.setOperationName(new QName("HelloWorld"));

//String s1 = "DESC-NCB-TXN-PROG";
//String s2 = "c:/rana/test/elec_filing.xml";

call.invoke(new Object [] {});



%>
But when i am running this from browser in tomcat the following page is displayed.

exception

Server did not recognize the value of HTTP Header SOAPAction: http://tempuri.org/WebService1.
    org.apache.axis.message.SOAPFaultBuilder.createFau lt(SOAPFaultBuilder.java:221)
    org.apache.axis.message.SOAPFaultBuilder.endElemen t(SOAPFaultBuilder.java:128)
    org.apache.axis.encoding.DeserializationContext.en dElement(DeserializationContext.java:1087)
    org.apache.xerces.parsers.AbstractSAXParser.endEle ment(Unknown Source)
    org.apache.xerces.impl.XMLNSDocumentScannerImpl.sc anEndElement(Unknown Source)
    org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl$FragmentContentDispatcher.dispatch(Unknown Source)
    org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(Unknown Source)
    org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    org.apache.xerces.parsers.AbstractSAXParser.parse( Unknown Source)
    javax.xml.parsers.SAXParser.parse(Unknown Source)
    org.apache.axis.encoding.DeserializationContext.pa rse(DeserializationContext.java:227)
    org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPar t.java:696)
    org.apache.axis.Message.getSOAPEnvelope(Message.ja va:424)
    org.apache.axis.handlers.soap.MustUnderstandChecke r.invoke(MustUnderstandChecker.java:62)
    org.apache.axis.client.AxisClient.invoke(AxisClien t.java:206)
    org.apache.axis.client.Call.invokeEngine(Call.java :2765)
    org.apache.axis.client.Call.invoke(Call.java:2748)
    org.apache.axis.client.Call.invoke(Call.java:2424)
    org.apache.axis.client.Call.invoke(Call.java:2347)
    org.apache.axis.client.Call.invoke(Call.java:1804)
    org.apache.jsp.netpractice_jsp._jspService(netprac tice_jsp.java:86)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.30

give suggestions

Debajit gupta
 
Old October 4th, 2005, 01:47 AM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello mr deb net ,

        can you help me on the same but i am getting the
services invoked but the value sent from me is becomming null
in the process of invoking .Net service

here is my code
can u plz help me.
thanku
anand.

<%@ page import="java.util.Date,org.apache.axis.client.Call ,org.apache.axis.client.Service,
javax.xml.namespace.QName,java.io.IOException,org. apache.axis.soap.SOAPConstants,
java.net.URL,org.apache.axis.encoding.XMLType,org. w3c.dom.Document,
javax.xml.rpc.ParameterMode,javax.xml.rpc.ServiceF actory,java.lang.System;" %>

 <%!
    private static String qnameService = "Service1";
    private static String qnamePort = "Service1Soap";

    private static String BODY_NAMESPACE_VALUE =
        "http://tempuri.org/";
    private static String ENCODING_STYLE_PROPERTY =
        "javax.xml.rpc.encodingstyle.namespace.uri";
    private static String NS_XSD =
        "http://www.w3.org/2001/XMLSchema";
    private static String URI_ENCODING =
         "http://schemas.xmlsoap.org/soap/encoding/";

 %>

<%

      try
        {

        String endpoint = "http://192.9.200.64/WebService1/Service1.asmx";
        ServiceFactory factory = ServiceFactory.newInstance();
        Service service = (Service) factory.createService(new QName(qnameService));
        QName port = new QName(qnamePort);
        Call call =(Call) service.createCall(port);

        call.setTargetEndpointAddress(endpoint);

        call.setProperty(Call.SOAPACTION_USE_PROPERTY,new Boolean(true));
        call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://tempuri.org/WebService1/Service1/ADD");
        call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);

        QName QNAME_TYPE_INT = new QName(NS_XSD, "int");

        call.setOperationName(new QName(BODY_NAMESPACE_VALUE, "ADD"));

        call.addParameter("x", QNAME_TYPE_INT,ParameterMode.IN);
        call.addParameter("y", QNAME_TYPE_INT,ParameterMode.IN);
        call.setReturnType(QNAME_TYPE_INT);

        //invoke the call
        Integer[] params = {new Integer(20),new Integer(40)} ;
        Integer se = (Integer) call.invoke(params);
        out.println("Result is :"+call.invoke(params));




      } catch (Exception ex) {
            ex.printStackTrace();
            out.println("errror: "+ex.toString());
         }


%>





 
Old June 12th, 2007, 12:40 AM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nirumagic
Default

Hi,

I am also facing same problem in invoking .Net Web services with AXIS 1.4.

Values getting null at server side.

Please share the things on this,


Thanks in advance





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Axis web service from .NET client Koushik .NET Web Services 4 April 2nd, 2010 09:16 PM
Calling Axis Web Service from VB.NET - XML distort Koushik VB.NET 0 October 28th, 2006 07:32 AM
Consuming Axis Web Service from .NET - Problem Koushik .NET Web Services 0 October 28th, 2006 07:29 AM
Calling Axis web service from .Net - XML Exchange Koushik .NET Web Services 0 October 23rd, 2006 11:40 AM
Apache, Axis and JDK for web service problem solomon_13000 Apache Tomcat 0 August 26th, 2005 08:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.