Jump to content
Changes to the Jaspersoft community edition download ×

Webservice call to jasper server


hari_k

Recommended Posts

Hi,

 

We were trying to call  a web service from java class but getting the following error.

AxisFault
 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode:
 faultString: (401)Unauthorized
 faultActor:
 faultNode:
 faultDetail:
    {}:return code:  401
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 401--Unauthorized</TITLE>
<META NAME="GENERATOR" CONTENT="WebLogic Server">
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 401--Unauthorized</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.2 401 Unauthorized</H4>
</FONT><P><FONT FACE="Courier New">The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.</FONT></P>
</FONT></TD></TR>
</TABLE>

</BODY>
</HTML>

    {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)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.jaspersoft.jasperserver.ws.scheduling.ReportSchedulerSoapBindingStub.scheduleJob(ReportSchedulerSoapBindingStub.java:437)
    at TestScheduling.main(TestScheduling.java:33)
 

 

We deployed jasper server on weblogic 10 with oracle database.

we are able to login to the jasper server and upload/run reports direclty but through webservice we are getting the above error.

 

below is the jave code:

 

 

 

Any suggestions on this is appreciated.

Code:
public static void main(String a[]){        ReportSchedulerSoapBindingStub obj=null;                   try {                obj=new ReportSchedulerSoapBindingStub                (new URL("http://localhost:7001/jasperserver/services/ReportScheduler"), null);                obj.setUsername("jasperadmin");                obj.setPassword("jasperadmin");                               //obj.setHeader(header);                Job job=new Job();                                              JobSimpleTrigger simpleTrigger=new JobSimpleTrigger();                job.setReportUnitURI("/CCER/jaspertrail/");                //job.setSimpleTrigger(simpleTrigger);                obj.scheduleJob(job);                                          } catch (MalformedURLException e) {                // TODO Auto-generated catch block                e.printStackTrace();            }  catch (RemoteException e) {                // TODO Auto-generated catch block                e.printStackTrace();            }           }
Link to comment
Share on other sites

  • 9 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

I have the same problem.

JasperServer is just installed on ubuntu and I can login to repository and view reports and browse repository.

The url: http://192.168.11.196:8080/jasperserver/services/repository return this result:

repository

Hi there, this is an AXIS service!

Perhaps there will be a form for invoking the service here...

In the Jaspersoft Studio I can create DataAdapter and test is passed

Cannot connect to JasperServer repository

 

Code:
Error details:AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode:  faultString: (401)Unauthorized faultActor:  faultNode:  faultDetail: 	{}:return code:  401<html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - Bad credentials</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Bad credentials</u></p><p><b>description</b> <u>This request requires HTTP authentication (Bad credentials).</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>	{http://xml.apache.org/axis/}HttpErrorCode:401(401)Unauthorized	at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:221)	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)	at org.apache.axis.client.Call.invoke(Call.java:2767)	at org.apache.axis.client.Call.invoke(Call.java:2443)	at org.apache.axis.client.Call.invoke(Call.java:2366)	at org.apache.axis.client.Call.invoke(Call.java:1812)	at com.jaspersoft.ireport.jasperserver.ws.RepositorySoapBindingStub.list(Unknown Source)	at com.jaspersoft.ireport.jasperserver.ws.WSClient.list(Unknown Source)	at com.jaspersoft.ireport.jasperserver.ws.WSClient.list(Unknown Source)	at com.jaspersoft.studio.server.WSClientHelper.checkConnection(Unknown Source)	at com.jaspersoft.studio.server.wizard.ServerProfileWizard$2.run(Unknown Source)	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)Environment:Windows 7 x64Jaspersoft Studio.exe *** Platform Details:*** System properties:awt.toolkit=sun.awt.windows.WToolkiteclipse.application=com.jaspersoft.studio.rcp.applicationeclipse.commands=-oswin32-wswin32-archx86_64-showsplash-launcherC:JaspersoftJaspersoft Studio-1.0.7Jaspersoft Studio.exe-nameJaspersoft Studio--launcher.libraryC:JaspersoftJaspersoft Studio-1.0.7\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502eclipse_1406.dll-startupC:JaspersoftJaspersoft Studio-1.0.7\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar--launcher.overrideVmargs-exitdata4e0_5c-data@user.home/JaspersoftWorkspace-clean-vmC:Windowssystem32javaw.exeeclipse.home.location=file:/C:/Jaspersoft/Jaspersoft Studio-1.0.7/eclipse.launcher=C:JaspersoftJaspersoft Studio-1.0.7Jaspersoft Studio.exeeclipse.launcher.name=Jaspersoft Studioeclipse.p2.data.area=@config.dir/../p2eclipse.p2.profile=profileeclipse.product=com.jaspersoft.studio.rcp.producteclipse.startTime=1327131774479eclipse.vm=C:Windowssystem32javaw.exeeclipse.vmargs=-Xms128m-Xmx512m-XX:PermSize=128M-XX:MaxPermSize=256M-jarC:JaspersoftJaspersoft Studio-1.0.7\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jarfile.encoding=Cp1257file.encoding.pkg=sun.iofile.separator=java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironmentjava.awt.printerjob=sun.awt.windows.WPrinterJobjava.class.path=C:JaspersoftJaspersoft Studio-1.0.7\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jarjava.class.version=50.0java.endorsed.dirs=C:Program FilesJavajre6libendorsedjava.ext.dirs=C:Program FilesJavajre6libext;C:WindowsSunJavalibextjava.home=C:Program FilesJavajre6java.io.tmpdir=C:UsersDARRAL~1.ARTAppDataLocalTempjava.library.path=C:Windowssystem32;C:WindowsSunJavabin;C:Windowssystem32;C:Windows;C:Program Files (x86)PC Connectivity Solution;C:Program FilesCommon FilesMicrosoft SharedWindows Live;C:Program Files (x86)Common FilesMicrosoft SharedWindows Live;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesThinkPadBluetooth Software;C:Program FilesThinkPadBluetooth Softwaresyswow64;C:Program FilesBroadcomWHL;C:Program FilesBroadcomWHLsyswow64;C:Program FilesBroadcomWHLSysWow64;C:Program FilesBroadcomWHLSysWow64syswow64;C:Program Files (x86)Common FilesLenovo;C:Program Files (x86)Windows LiveShared;C:SWTOOLSReadyApps;C:Program Files (x86)IntelServicesIPT;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program Files (x86)LenovoAccess Connections;c:Program Files (x86)Microsoft SQL Server100ToolsBinnVSShellCommon7IDE;c:Program Files (x86)Microsoft SQL Server100ToolsBinn;c:Program FilesMicrosoft SQL Server100ToolsBinn;c:Program Files (x86)Microsoft SQL Server100DTSBinn;C:Program Files (x86)QuickTimeQTSystem;C:Program Files (x86)Common FilesSYSTEMMSMAPI1033;C:Program Files (x86)Subversionbin;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;.java.protocol.handler.pkgs=org.apache.axis.transport|java.runtime.name=Java(TM) SE Runtime Environmentjava.runtime.version=1.6.0_30-b12java.specification.name=Java Platform API Specificationjava.specification.vendor=Sun Microsystems Inc.java.specification.version=1.6java.vendor=Sun Microsystems Inc.java.vendor.url=http://java.sun.com/java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgijava.version=1.6.0_30java.vm.info=mixed modejava.vm.name=Java HotSpot(TM) 64-Bit Server VMjava.vm.specification.name=Java Virtual Machine Specificationjava.vm.specification.vendor=Sun Microsystems Inc.java.vm.specification.version=1.0java.vm.vendor=Sun Microsystems Inc.java.vm.version=20.5-b03line.separator=..........................................

Post Edited by darral at 01/21/2012 08:23
Link to comment
Share on other sites

  • 1 month later...

Did you resolve this issue? I have the same issue. I am setting the username and password as mentioned in the sample file.

 

My code looks like te following.

Code:
import java.io.File;import com.jaspersoft.ireport.jasperserver.JServer;import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor;public class JasperResourceUploader {		public static void main (String[] args) throws Exception{				JServer server = new JServer();		server.setUrl("http://localhost:8080/jasperserver/services/repository");		server.setUsername("jasperddmin");		server.setPassword("jasperadmin");				ResourceDescriptor rdis = new ResourceDescriptor();		rdis.setResourceType(ResourceDescriptor.TYPE_IMAGE);		rdis.setName("bla");		rdis.setLabel("bla");		rdis.setDescription("Test Image Description");		rdis.setParentFolder("/images");				rdis.setUriString(rdis.getParentFolder() + "/" + rdis.getName());		rdis.setWsType(ResourceDescriptor.TYPE_IMAGE);		File img = new File("c:\\team\\P6290019.jpg");		rdis.setHasData(true);		rdis.setIsNew(true);		ResourceDescriptor result = server.getWSClient().addOrModifyResource(rdis, img);		System.out.println("************"+result.toString());					}}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...