Web Services :: Request Sent By The Client Was Syntactically Incorrect When Using Hebrew
Dec 18, 2014
I have an apache server with rest APIs accepting Json object and produce Json object.testing the sever using Chrome advanced rest client show no problems.I then tried to create a jave client, using org.jboss.resteasy:
public T sendPostRequest(String url, T input) throws Exception {
ClientRequest request = getNewClientRequest(url);
ObjectMapper om = new ObjectMapper();
final String body = om.writeValueAsString(input);
request.body(MediaType.APPLICATION_JSON, body);
final ClientResponse<String> responseObj = request.post(String.class);
validateResponseString(url, responseObj);
String responseString = responseObj.getEntity(String.class);
responseObj.releaseConnection();
[code]....
View Replies
ADVERTISEMENT
Nov 27, 2014
I am calling a SOAP based webservice using JAX-WS and a client jar. I want to get a request and response somehow and save it for audit purposes. How I can do this?
When I google it, only Handlers come up, but, as far as I understand, it is not applicable on client side.
View Replies
View Related
Nov 14, 2014
I generated a WebService from a WSDL using JAXWS and import the finally generated WSDL to my SOAPUI to send out the request and view the response. For some reason, I always have to set WSS TimeToLive as 1000 in the request properties, else I get an error in the response. Now, I generated a client from the WSDL. I wonder if I need to set the WSS TimeToLive here as well
View Replies
View Related
Mar 23, 2015
I want to write one REST client program for POST request ,request and response is in JSON Format.
public String getAck() {
HttpURLConnection httpConnection = null;
URL url=null;
try {
url = new URL("http://test:8080/ils/main");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
[Code]....
Line OutputStream os = httpConnection.getOutputStream();
I am getting connection time out problem
View Replies
View Related
Nov 27, 2014
I want to print RAW Request Response XML to console. I have created the stubs using wsdl2java axis2. wsdl2java has created 2 java files, one for stub and one for callbackhandler.
I am trying with below method but getting null value for
operationContext.getMessageContext("Out") / operationContext.getMessageContext("In");.
public void SOAPLogHandler(Stub stub){
ServiceContext serviceConxt = stub._getServiceClient().getServiceContext();
//**** Enable the Cache to hold the last operation
OperationContext OperationContext = new OperationContext();
boolean cacheLastOperationContext = true;
OperationContext.setComplete(true); // Enable the Cache value
serviceConxt.setCachingOperationContext(cacheLastOperationContext);
serviceConxt.setLastOperationContext(OperationContext);
[code]....
View Replies
View Related
Feb 23, 2015
In SOAPUI, how can I add a new property in a HTTP Test Request? I konw that this there isn´t, but should be somethink like that:
testRunner.testCase.getTestStepByName("myHttpTestRequest").addProperty("newProperty","newValue");
View Replies
View Related
Apr 6, 2015
I am trying to generate this request with my Java program, but I just can't seem to figure it out: curl -v -H "Authorization:Basic MY_AUTH_CODE" -H "Accept:application/xml" -H "app_id:MY_APP_ID" -H "app_key:MY_APP_KEY" -X GET "THIRD_PARTY_URL"
I tried to generate a query string, but I keep getting 403 errors. I also tried to input my parameters using URLConnection.getRequestProperty("name", "value"), but that didn't work either.
View Replies
View Related
Jan 20, 2015
I created the WSDL first in RSA and then created the java bean skelaton from the WSDL. There are a couple of dateTime fields in the WSDL that are created as GregorianCalendar objects.
When I test with SOAPui and the date fields are passed correctly, everything works great. But when there is an invalid date format or anything else in the SOAP request, instead of returning a Conversion exception or some other validation exception, the field is passed as a null to the request object in the SOAP IMPL. Should't this return an exception?
Sample requests inputs:
<endTimeStamp>2014-01-28T01:30:14.474Z</endTimeStamp> - Date
<endTimeStamp>06-FEB-14 01.51.00.000000000 AM</endTimeStamp> - Null
<endTimeStamp>Any other string be it a date or not.</endTimeStamp> - Null
[Code].....
View Replies
View Related
Apr 1, 2015
I'm creating a SOAP Client with JS, this is my first time with webServices and I must have several mistakes in my code.
The poit is, with my code, I cant take acces to the WebService, but I don't know how to access to the methods inside. So the webservice gives me the following response:
<h1>Version</h1>
<p>Hi there, this is an AXIS service!</p>
<i>Perhaps there will be a form for invoking the service here...</i>
Instead of the correct XML for the method I'm calling.
This is the code of my SOAP client:
<html>
<script type="text/javascript">
function run(){
var objXMLHttpRequest = new XMLHttpRequest();
objXMLHttpRequest.open("GET", "http://localhost:8080/CrunchifyWS/services/Version?wdsl/", true);
objXMLHttpRequest.onreadystatechange = function () {
//alert(objXMLHttpRequest.readyState+" "+ objXMLHttpRequest.status);
[code]....
I think that te mistake should be in the XML part, but, as I said, this is my first time and I don't know what I'm doing.
When I try to do POST instead of GET I have this reposnse:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="w3.org/2001/XMLSchema"; xmlns:xsi="w3.org/2001/XMLSchema-instance">; <soapenv:Body> <soapenv:Fault> <faultcode xmlns:ns1="xml.apache.org/axis/">ns1:Client.NoSOAPAction</…; <faultstring>no SOAPAction header!</faultstring> <detail> <ns2:hostname xmlns:ns2="xml.apache.org/axis/">WebServices-PC</…; </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
View Replies
View Related
Nov 21, 2014
I need to invoke a restful webservice Client(Rest) from my Webapp based on some scheduler . Also I need to persist the data which the webservice returns in response. So basically-
1. Scheduler triggers, I need to build the rest service request (JSON) and invoke it.
2. Capture the response of the webservice and persist the data in DB.
Technical stack used- Spring MVC
View Replies
View Related
Feb 22, 2015
I would like to access a third party websevice using a Java client that I generated with JAX-WS wsimport, based on the WSDL provided (I am using a Maven plugin).
For quite a while I was unable to retrieve a useful response, not in the Java client and also not in SoapUI, until I found out that I had to enable WS-A on the request. In SoapUI this now results in the expected response, but what must I do to also 'enable' WS-A in the Java client? Do I maybe have to alter the WSDL, or add a parameter to wsimport?
I found some documentation on WS-A online, but so far could not find an answer.
View Replies
View Related
Dec 12, 2014
New to webservices. Can i get to create webservice which takes xml input. Parse it and gives the response to client.
View Replies
View Related
Jul 17, 2013
So far I only know using
request.getRemoteAddr() get
to get user IP address, is that a way to get Users PC memory?
long maxMemory = runtime.maxMemory();
long allocatedMemory = runtime.totalMemory();
long freeMemory = runtime.freeMemory();
Only get server memory not the client....
View Replies
View Related
Aug 14, 2014
I'm making a program to demonstrate Exception Handling. (Note: the code was written inside towards out). The user is prompted to input two values (integers) and then the program will divide those values and output the result.
I then added the "try" and "catch keywords for exception handling-instead of the program shutting down if an error occurs, the words "you cant do that" will appear
I then added a while loop to allow the user another chance to input usable values. Of course, I made sure to make a termination to the loop as well.
Everything works as expected if the user inputs e.g 8 divided by 0. in that case exception occurse, the user is told "you cant do that", is then prompted to start over and so forth until he gives usable integers. then the program continues to the termination. However, if the user inputs a String , e.g 9 divided by xyz, then the program goes into an endless loop
My question is:
1) why does a String cause an endless loop ( I have a theory)
2)why does the loop occur as soon as I put in an incorrect value- is the while loop somehow in extant? somehow always waiting? (hard to picture it)
3) lastly, what would be the correct code to handle and exception caused by a String (as opposed to being caused by impossible to execute math)
Here is the program
package inschool;
/*
*GOAL: to allow for an exception to occur without causing the entire program to stop.
*NOTE: the coding was written from the center outwards (e.g first "System.out.println", then "try", then "do")
*/
import java.util.*;
public class L82_ExceptionHandling {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
[Code] .....
View Replies
View Related
Jun 16, 2014
I've been stuck on this one for a while. If you scroll down to the while loop there is some code that calculates the angle of a triangle created by two circles colliding. The problem is, The angle between the hypotenuse / x axis, and the angel between the hypotenuse / y axis never go above 65 degrees and i have no clue why?
import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.JComponent;
import javax.swing.JFrame;
public class MainTest extends JFrame {
public rectt g = new rectt();
[Code] .....
View Replies
View Related
Feb 25, 2014
I have the following questions:
1. Does a GET HTTP request contain a request body? If yes what is contained in it? Are the request headers also part of the request body?
2. Is it possible to send a byte array as part of the GET request in its body?
3. Is there a size limitation on the data that can be sent via a GET request?
View Replies
View Related
Oct 8, 2014
I am working on an assignment, and I have come up with a program that runs, but it does not run correctly. This is the assignment:
Write two overloaded methods that return the average of an array with the following headers:
public static int average(int[] array)
public static double average(double[] array)
Write a test program that prompts the user to enter ten double values, invokes this method and displays the average value.
When I run it my averages are coming out incorrect, and I am not sure why. I have tried moving and rearranging things and nothing is working.
Java Code:
public static int average(int[] array) {
int sum = 0;
int average = 0;
[Code].....
View Replies
View Related
Mar 24, 2014
How to get used to program control statements. This is an attempt to write a program that returns the number of days between two dates. Sadly, it give incorrect values.
public class DaysBetweenDates {
public static boolean isLeapyear(int year) {//This method will determine if a year is a leap year or not
boolean isTrue=false;
if(year%4==0 && year%100!=0) isTrue=true;
else if(year%400==0) isTrue=true;
return isTrue;
[Code] ....
View Replies
View Related
Jan 27, 2015
I am using the calendar component of the primefaces and I am using the attribute pattern="MM/dd/yyyy.But when I print the values in my MBean along with the selected date event the timeZone (i think) is printed as Sun Mar 29 00:00:00 IST 2015 I do not understand why its printed even though I have set the pattern.Part of my code :
XHTML
<p:calendar id="singleDaySchedule" value="#{scheduleMBean.exactDate}"
showOn="button" pattern="MM/dd/yyyy" required="true" requiredMessage="Date is Required"/>
<p:commandButton value="Submit" update="form" actionListener="#{scheduleMBean.showSchedule}" icon="ui-icon-check" />
[Code] ....
I found out that we need to use <f:convertDateTimePattern> instead of how I am using currently.But I am not able to figure out where to use
<f:convertDateTimePattern>
in my case
View Replies
View Related
Jan 23, 2015
I have tried each and every thing in all the other answers. Like setting chunked to false, changing parameters, changing http1.1 -1.0. I am just writing a sample client to compare it with my real time client. Following is the code of client:
package com.webservicemart.ws;
import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;
import com.webservicemart.ws.USZipStub.ValidateZip;
public class UsZipClient {
public static void main(String[] args) {
[Code] ....
And Following is the error :
[INFO] Unable to sendViaPost to url[http://www.webservicemart.com/uszip.asmx]
org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
[Code] ....
I have tried with other geoIP service and weather forecast too. I get the same error.
View Replies
View Related
Mar 26, 2015
how to implement the Rest API which is like "URL...". And how to implement in Java where the class extends ServerResource.
View Replies
View Related
Mar 23, 2015
I don't seem to be hitting my RESTful webservices. I am using Hibernate and checked and all my entity classes are working. I've even retrieved data from the database but I cannot hit the web service. I am using Tomcat 7 and Eclipse IDE.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>HibEx1</groupId>
<artifactId>HibEx1</artifactId>
[Code] .....
I have a web xml but there is really nothing in it. The url i am wanting to hit is [URL] ..... Is this a correct URL?
I also tried changing my Path to "/service" and that did not work either. I am getting a Http Status 404 "The requested resource is not available.
View Replies
View Related
Aug 6, 2008
I am using AXIS2 tomcat6 and jre1.6.0_07 and I created java project using net beans. but when I execute java2wsdl I am getting the following. Can you solve my problem? Also I would like to know what is the function of java2wsdl and its parameters?T
C:axis2-1.4-binaxis2-1.4in>%AXIS2_HOME%injava2wsdl -cp . -cn samples.quickstart.service.pojo.StockQuoteService -of StockQuoteService.wsdlUsing AXIS2_HOME: c:axis2-1.4-binaxis2-1.4Using JAVA_HOME: C:Program FilesJavajre1.6.0_07An error occured while generating codejava.lang.ClassNotFoundException: samples.quickstart.service.pojo.StockQuoteService C:axis2-1.4-binaxis2-1.4in>
View Replies
View Related
Mar 9, 2015
package com.dnex;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
[code]....
I am getting the connection time out error in below line :-
System.out.println("response code"+httpConnection.getResponseMessage());
Note:-I need to pass user id and pwd in header parameter.and I am using https connection.
View Replies
View Related
Dec 21, 2014
I have created a SOAP client and initiate the transaction using proxy objects.Need to log the raw SOAP request/response XML message.
PaymentsAppServiceProxy proxy=new PaymentsAppServiceProxy();
QueryTransactionRequest request=new QueryTransactionRequest();
//Need to print the actual XML from the request
try {
QueryTransactionResponse response=proxy.queryTransaction(request);
[code]....
View Replies
View Related
Jan 24, 2015
I am new to web services and need to call a web service that has already been written. Below is the wsdl for the web service.I need to call the web service from my java program. provide the code to call the webservice?
<definitions targetNamespace="urnefaultNamespace">
<message name="CREATECONTACTUSResponse"></message>
<message name="CREATECONTACTUSRequest">
<part name="REQUESTTYPE" type="xsd:string"/>
<part name="SALESORG" type="xsd:string"/>
<part name="FIRSTNAME" type="xsd:string"/>
<part name="LASTNAME" type="xsd:string"/>
<part name="EMAILADDRESS" type="xsd:string"/>
<part name="TELEPHONENUMBER" type="xsd:string"/>
<part name="EXTENSION" type="xsd:string"/>
[code]....
View Replies
View Related