axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NY...@aol.com
Subject Re: Namespaces & Clients
Date Tue, 15 Jun 2004 16:23:26 GMT
 
package com.sample.www.sampleDirect;
 
public interface ReportHandlerService extends javax.xml.rpc.Service  {
public java.lang.String  getReportHandlerServicePortAddress();
 
    public com.sample.www.sampleDirect.ReportHandler  
getReportHandlerServicePort() throws javax.xml.rpc.ServiceException;
 
    public com.sample.www.sampleDirect.ReportHandler  
getReportHandlerServicePort(java.net.URL portAddress) throws  javax.xml.rpc.ServiceException;
}
 

package com.sample.www.sampleDirect;
 
public class ReportHandlerServiceLocator extends  
org.apache.axis.client.Service implements  com.sample.www.sampleDirect.ReportHandlerService
{
 
    // Use to get a proxy class for  ReportHandlerServicePort
private final java.lang.String  ReportHandlerServicePort_address = 
"_http://www.sample.com/sampleDirect_ (http://www.sample.com/sampleDirect) ";
 
    public java.lang.String  getReportHandlerServicePortAddress()  {
return  ReportHandlerServicePort_address;
}
 
    // The WSDD service name defaults to the port  name.
private java.lang.String  ReportHandlerServicePortWSDDServiceName = 
"ReportHandlerServicePort";
 
    public java.lang.String  getReportHandlerServicePortWSDDServiceName()  {
return  ReportHandlerServicePortWSDDServiceName;
}
 
    public void  setReportHandlerServicePortWSDDServiceName(java.lang.String 
name)  {
ReportHandlerServicePortWSDDServiceName = name;
}
 
    public com.sample.www.sampleDirect.ReportHandler  
getReportHandlerServicePort() throws javax.xml.rpc.ServiceException  {
java.net.URL  endpoint;
try  {
endpoint  = new  java.net.URL(ReportHandlerServicePort_address);
}
catch  (java.net.MalformedURLException e)  {
throw  new  javax.xml.rpc.ServiceException(e);
}
return  getReportHandlerServicePort(endpoint);
}
 
    public com.sample.www.sampleDirect.ReportHandler  
getReportHandlerServicePort(java.net.URL portAddress) throws  javax.xml.rpc.ServiceException
{
try {
com.sample.www.sampleDirect.sampleDirectBindingStub _stub = new  
com.sample.www.sampleDirect.sampleDirectBindingStub(portAddress,  this);
_stub.setPortName(getReportHandlerServicePortWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault  e) {
return null;
}
}
 
    /**
* For the given  interface, get the stub implementation.
* If this  service has no port for the given interface,
* then  ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws  
javax.xml.rpc.ServiceException {
try {
if  
(com.sample.www.sampleDirect.ReportHandler.class.isAssignableFrom(serviceEndpointInterface))
 {
com.sample.www.sampleDirect.sampleDirectBindingStub _stub = new  
com.sample.www.sampleDirect.sampleDirectBindingStub(new  
java.net.URL(ReportHandlerServicePort_address),  this);
_stub.setPortName(getReportHandlerServicePortWSDDServiceName());
return  _stub;
}
}
catch (java.lang.Throwable t)  {
throw  new  javax.xml.rpc.ServiceException(t);
}
throw new  javax.xml.rpc.ServiceException("There is no stub implementation 
for the  interface:  " + (serviceEndpointInterface == null ? "null" :  
serviceEndpointInterface.getName()));
}
 
    /**
* For the given  interface, get the stub implementation.
* If this  service has no port for the given interface,
* then  ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class  
serviceEndpointInterface) throws javax.xml.rpc.ServiceException  {
if (portName == null)  {
return  getPort(serviceEndpointInterface);
}
String inputPortName =  portName.getLocalPart();
if  ("ReportHandlerServicePort".equals(inputPortName))  {
return  getReportHandlerServicePort();
}
else   {
java.rmi.Remote _stub =  getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub)  _stub).setPortName(portName);
return _stub;
}
}
 
    public javax.xml.namespace.QName getServiceName()  {
return new  javax.xml.namespace.QName("_http://www.sample.com/sampleDirect_ 
(http://www.samplerep.com/sampleDirect) ",  "ReportHandlerService");
}
 
    private java.util.HashSet ports = null;
 
    public java.util.Iterator getPorts()  {
if (ports == null)  {
ports =  new  java.util.HashSet();
ports.add(new  javax.xml.namespace.QName("ReportHandlerServicePort"));
}
return  ports.iterator();
}
 
}
 
In a message dated 6/15/2004 4:18:27 PM Eastern Standard Time,  
MeloroJ@Pragmatics.com writes:

Okay, now we are getting  somewhere...
 
The WSDL2Java task should have created  some files called 
<something>Service.java and  <something>ServiceLocator.java.
 
If you post those files I can reply with  what line 26 in the client I gave 
you should look like.
 
 

-----Original Message-----
From: NYY96@aol.com  [mailto:NYY96@aol.com]
Sent: Tuesday, June 15, 2004 4:06  PM
To: axis-user@ws.apache.org
Subject: Re: Namespaces  & Clients



I didn't touch the deployment descriptor except to add a handler. Other  than 
that small portion of code the descriptor is the same as was generated  by 
WSDL2Java
 
Jim
In a message dated 6/15/2004 3:54:46 PM Eastern Standard Time,  
MeloroJ@Pragmatics.com writes:

How did you create the deploy.wsdd  file?  The service class and the service 
locator class should have  been generated at the same time.
 
In order to call your service, or any  service, you will need to have the 
"stub" files that were supposed to be  autogenerated with the deploy.wsdd file.
 

-----Original Message-----
From: NYY96@aol.com  [mailto:NYY96@aol.com]
Sent: Tuesday, June 15, 2004 3:35  PM
To: axis-user@ws.apache.org
Subject: Re:  Namespaces & Clients



Yes I did, but this brings me back to my original question:
I have the namespace setup to go to _http://www.sample.com/SampleDirect_ 
(http://www.sample.com/SampleDirect) ,  however for the purposes of me setting 
this up primarily and running it  on a Tomcat local server, do I have to change 
that namespace to  something different, such as 
_http://localhost:8080/axis/sampledirect_ (http://localhost:8080/axis/sampledirect) ??  In
other words, is 
the reason it cannot find what it's looking for stem  all the way back to the 
Namespace in my WSDL? Or is there a way I could  change this in the client?
 
Thanks! I feel like it's almost there!
James
 
In a message dated 6/15/2004 3:28:00 PM Eastern Standard Time,  
MeloroJ@Pragmatics.com writes:

The error you are getting means  that the server cannot find the service you 
are trying to  invoke.  Most likely because you are not forming the url  
correctly.
 
Did you deploy the AXIS service  via a deploy.wsdd file?
 

-----Original Message-----
From: NYY96@aol.com  [mailto:NYY96@aol.com]
Sent: Tuesday, June 15, 2004 3:13  PM
To: axis-user@ws.apache.org
Subject: Re:  Namespaces & Clients



Do you mean something like this:
 
Service servce = new Service(ReportHandlerService);
 
I'm not quite sure what you mean. I have a  ReportHandlerService, how exactly 
should it be formatted.
 
I really do appreciate the continued help. All the tutorials  and such show 
you nicely how to set up and deploy a service but I  need the guidance at 
utilizing it. 
 
My previous client output the following information:
- requestor request
- <soapenv:Envelope 
xmlns:soapenv="_http://schemas.xmlsoap.org/soap/envelope/_ (http://schemas.xmlsoap.org/soap/envelope/)
"  xm
lns:xsd="_http://www.w3.org/2001/XMLSchema_ 
(http://www.w3.org/2001/XMLSchema) "  xmlns:xsi="_http://www.w3.org/2001/XML_ (http://www.w3.org/2001/XML)

Schema-instance">
<soapenv:Body>
<report xmlns="_http://www.sample.com/SampleDirect_ 
(http://www.sample.com/SampleDirect) ">
<account>1234567</account>
<xmlData>Really Really Long string of GOOD  STUFF!</xmlData>
</report>
</soapenv:Body>
</soapenv:Envelope>
AxisFault
faultCode:  {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString:  (404)Not  Found
faultActor:
faultNode:
faultDetail:
{}string: return code:  404
 
 
Thanks,
James
 
In a message dated 6/15/2004 3:00:30 PM Eastern Standard Time,  
MeloroJ@Pragmatics.com writes:

Sorry about  that...
 
On line 26 Service service =  new Service( );
 
Should really be the name of  the Service interface of the Web services.    

Since you have deployed the services to AXIS, do you  have the autogenerated 
service file created by Apache Axis  WSDL2Java emitter?

[Meloro,  John]  -----Original  Message-----
From: NYY96@aol.com  [mailto:NYY96@aol.com]
Sent: Tuesday, June 15, 2004 2:10  PM
To: axis-user@ws.apache.org
Subject: Re:  Namespaces & Clients




This produces errors:
 
ReportHandlerClient.java:26: javax.xml.rpc.Service is  abstract; cannot be 
instantiated        Service service = new Service( );
                        ^
ReportHandlerClient.java:27: cannot resolve  symbol
symbol  : class Call
location: class  com.sample.www.SampleDirect.ReportHandlerClient
Call call = (Call)  service.createCall();
^
ReportHandlerClient.java:27: cannot resolve  symbol
symbol  : class Call
location: class  com.sample.www.SampleDirect.ReportHandlerClient
Call call = (Call)  service.createCall();
^
3 errors
In a message dated 6/15/2004 1:55:36 PM Eastern Standard  Time, 
MeloroJ@Pragmatics.com writes:

All right then, now we have confirmed that your service(s)  are deployed and 
we can focus on the client piece. 
Let's start with a simple client and get  that to work.  Later you can add to 
it.  Also, later  on I'll walk you through how to set up TCPmon.  Remember,  
until you have gone through this a few times eliminate  what you don't know so 
you can  focus on one thing at a time.
 
Here is a simple client for you to try:
                             
 
package com.sample.www.directsample;

import org.apache.axis.client.Call;
import  org.apache.axis.client.Service;
import  org.apache.axis.encoding.XMLType;
import  javax.xml.namespace.QName;
import  javax.xml.rpc.ParameterMode;
import java.net.*;
 
public class  ReportHandlerClient 
{
public  static void main( String[] args ) throws  Exception
{
      // URL of the web  service
      String  url = "_http://127.0.0.1:7001/axis/services/_ 
(http://127.0.0.1:7001/axis/services/) ReportHandlerServicePort  ";

/* Create an  instance of the Call Object  */
Service service = new  Service();
Call call =  (Call) service.createCall();
call.setTargetEndpointAddress( new URL( url  ));
 
      System.out.println();
System.out.println( "Connecting to: " + url  );
System.out.println();
 
      // Set parameter  definitions in the call  object
// Fill this in  after you're sure that you can locate and connect to the  
service.
 
      // Set the  definition of the return  type
// Fill this in  after you're sure that you can locate and connect to the  
service.
               
// Name of the  method to invoke
// Fill this  in after you're sure that you can locate and connect to the  
service
     }
}
}



-----Original Message-----
From:  NYY96@aol.com [_mailto:NYY96@aol.com_ (mailto:NYY96@aol.com) ]
Sent:  Tuesday, June 15, 2004 1:32 PM
To:  axis-user@ws.apache.org
Subject: Re: Namespaces &  Clients


I am dealing with the  ReportHandlerServicePort for now and only run a  very 
simply example through addReport.

And  now... Some Services
AdminService  (wsdl)
AdminService 
Version  (wsdl)
getVersion
SampleDirectService  (wsdl)
addReport 
ReportHandlerServicePort  (wsdl)
addReport
addReports
rmReport 
rmReports

In  a message dated 6/15/2004 1:30:41 PM Eastern Standard   Time,
MeloroJ@Pragmatics.com writes:
Okay, then please  post a copy of the  services list.  So, we can see  what we
are up  against...


-----Original  Message-----
From: NYY96@aol.com  [_mailto:NYY96@aol.com_ (mailto:NYY96@aol.com) ]
Sent:  Tuesday, June 15, 2004 1:27 PM
To:   axis-user@ws.apache.org
Subject: Re: Namespaces &  Clients


I  was able to figure out why that was  happening. It was a fault on my end,
nothing  major.  Hopefully you can help me with the other  issue.
James

In a  message dated 6/15/2004  1:23:24 PM Eastern Standard  Time,
MeloroJ@Pragmatics.com  writes:
So, when you  click on the "View" html tag you get a page back with   the list
of your web services.  However, when you go  to  
_http://localhost:8080/axis/services_ (http://localhost:8080/axis/services)  
you  don't?

That is very  bizarre...

Try typing  _http://127.0.0.1:8080/axis/happyaxis.jsp_ 
(http://127.0.0.1:8080/axis/happyaxis.jsp)   and  confirm that you
have installed AXIS correctly  and that it is  running.
-----Original  Message-----
From: NYY96@aol.com  [_mailto:NYY96@aol.com_ (mailto:NYY96@aol.com) ]
Sent:  Tuesday, June 15, 2004 12:57 PM
To:   axis-user@ws.apache.org
Subject: Re: Namespaces &  Clients


When  I go to the address you listed I  do not see a page, however if I go
through  _http://localhost:8080/axis_ (http://localhost:8080/axis)  I can 
click on  Services and see my service
deployed  (And access it's  WSDL). Does this mean I have some work to do  yet?

Also,  what settings on TCPMon would work for  my purposes. I don't need to
anything  complicated,  just some ports that will get my sample working.

Thanks  for  your continued help,
James

In a message  dated 6/15/2004 12:23:32 PM  Eastern Standard  Time,
MeloroJ@Pragmatics.com writes:
Well, lets take  things  one step at a time.

If you type _http://localhost:8080/axis/services_ 
(http://localhost:8080/axis/services)   into  a web browser then you
should see your  service(s) deployed.

Please post  that for me, so  I can verify that you have actually deployed  
the
services  correctly.  If that fails then  there is no sense in going on to
your client  because  there is nothing for the client to communicate with.

In  addition,  are you running TCPmon now?  If so,  TCPMon and TomCat cannot
listen on the  same port on  the same workstation.  You will have to modify 
one
or  the  other to listen on a different  port.

-----Original Message-----
From:   NYY96@aol.com [_mailto:NYY96@aol.com_ (mailto:NYY96@aol.com) ]
Sent:  Tuesday, June 15, 2004 12:04  PM
To:  axis-user@ws.apache.org
Subject: Re: Namespaces &   Clients


I wanted to avoid posting the code because  it is lengthy and  generally deals
with more than one  file but here it is. Thanks for your help. I  think when  
I
run the client it's attempting to access the net because  of the  namespace I
chose way back in the  WSDL.

If anybody's would be able to  tell me if my  reasoning is correct (Or help me
avoid having to do the  entire  java WSDL2Java over for nothing). I want to  
be
able to run this on the localhost  and use TCPMon  to see what's going on. If
you guys could give me a heads  up on  what needs to be adjusted to accomplish
that,  that would be  wonderful!

package  com.sample.www.directsample;

import   java.net.MalformedURLException;
import  java.net.URL;
import   java.rmi.RemoteException;
import  java.util.List;

import   javax.xml.namespace.QName;
import  javax.xml.rpc.Service;
import   javax.xml.rpc.ServiceException;
import   javax.xml.rpc.ServiceFactory;
import   javax.xml.rpc.handler.HandlerInfo;

import   com.sample.www.directsample.LoggingHandler;
import   com.sample.www.directsample._report;
import   com.sample.www.directsample._response;

public class  ReportHandlerClient 
{
static String router =   "_http://localhost:8080/axis/directsample_ 
(http://localhost:8080/axis/directsample) ";
static  String  service =  "directsampleService.wsdl";

public static void   main(String[] args)
{
try 
{
ServiceFactory  sf =  ServiceFactory.newInstance();
URL u = new  URL(router + "/" +  service);
String  url="_http://localhost:8080/axis/services/ReportHandlerService_ 
(http://localhost:8080/axis/services/ReportHandlerService) ";
QName  serviceName = new 
QName("_http://www.sample.com/directsample_ 
(http://www.sample.com/directsample) ","ReportHandlerService");
Service  s =  sf.createService(u,serviceName);

QName  portName = new 
QName("_http://www.sample.com/directsample_ 
(http://www.sample.com/directsample) ","ReportHandlerServicePort");

List  handlerChain =   s.getHandlerRegistry().getHandlerChain(portName);
HandlerInfo  hi = new   HandlerInfo(LoggingHandler.class,null,null);
handlerChain.add(hi);

ReportHandler  h =(ReportHandler)   s.getPort(portName,ReportHandler.class);

_report rpt =  new   _report();
rpt.setAccount("1234567");
rpt.setXmlData("Really  Really Long string of GOOD STUFF!");

try  {

_response  rsp =   h.addReport(rpt);
boolean value =  rsp.isSuccess();



}
catch(Exception   e)
{
e.printStackTrace(   );
}



} 
catch (ServiceException  se) 
{
se.printStackTrace();
} 
catch  (MalformedURLException  mue) 
{
mue.printStackTrace();
}
}
}

In  a message dated 6/15/2004 11:49:49 AM  Eastern Standard  Time,
MeloroJ@Pragmatics.com writes:
You are going to  have  to post the client code.  Without the code it  is
impossible to tell you  where you are going  wrong...
-----Original Message-----
From:   NYY96@aol.com [_mailto:NYY96@aol.com_ (mailto:NYY96@aol.com) ]
Sent:  Tuesday, June 15, 2004 11:44  AM
To:  axis-user@ws.apache.org
Subject: Namespaces &   Clients


I have successfully deployed a web service  with Axis. I have  written a
client which successfully  produces the SOAPEnvelope. Directly under  the  
Envelope's
output is a 404 HTTP Error listing. It also then  echo's the root  of the web
page I used as the  namespace.

If I want to run this service on  the  local host for now, what do I have to
change to get the  Client to execute  successfully?

Thanks for all  your generous support,
James   Crosson
NYY96@aol.com


























Mime
View raw message