Filter invoices by Customer ID PHP Devkit - intuit-partner-platform

I'm trying to filter invoices that I'm getting using QuickBook IPP and PHP devkit, but for some reason, quickbooks keeps sending back an empty result. My code is below:
$query = '<ContactIdSet><Id>340</Id></ContactIdSet>';
$invoices = $invoiceService->findAll($quickbooks->Context, $quickbooks->creds['qb_realm'], $query, 1, 999);
With this code, my request (minus Oauth info) is:
POST https://services.intuit.com/sb/invoice/v2/538361885 HTTP/1.1
Content-Type: text/xml
Authorization: OAuth realm="", oauth_signature_method="HMAC-SHA1", oauth_signature="", oauth_nonce="GAmtH", oauth_timestamp="1366692972", oauth_token="", oauth_consumer_key="", oauth_version="1.0"
Content-Length: 298
<?xml version="1.0" encoding="UTF-8"?>
<InvoiceQuery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.intuit.com/sb/cdm/v2">
<StartPage>1</StartPage>
<ChunkSize>999</ChunkSize>
<ContactIdSet>
<Id>340</Id>
</ContactIdSet>
</InvoiceQuery>
but even though there are invoices under that customer id, the response has no invoices:
HTTP/1.1 200 OK
Date: Tue, 23 Apr 2013 05:06:39 GMT
Server: Apache/2.2.22 (Unix)
ContextInitTime: 9
Response-Id: cb8b6eaa-f810-4fad-9f69-3485f400680d
IdRestateTime: 4
HeaderQueryTime: 4
Content-Encoding: gzip
HeaderDAOTime: 4
Response-App-Time: 62
Response-Routing-Time: 67
Content-Length: 133
Connection: close
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><RestResponse xmlns="http://www.intuit.com/sb/cdm/v2"><Invoices/></RestResponse>
Any ideas as to why quickbooks won't return the invoices that are associated with that customer?
Here is the XML response that shows the invoice exists when I use ->findAll()
HTTP/1.1 200 OK
Date: Tue, 23 Apr 2013 17:44:02 GMT
Server: Apache/2.2.22 (Unix)
LineQueryTime: 35
ContextInitTime: 94
Response-Id: 9b3d4e46-a6b5-4f90-81f4-3c42b0462330
AssemblingTime: 0
HeaderQueryTime: 91
Content-Encoding: gzip
HeaderDAOTime: 91
LineDAOTime: 35
Response-App-Time: 271
Response-Routing-Time: 276
Content-Length: 930
Connection: close
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><RestResponse xmlns="http://www.intuit.com/sb/cdm/v2"><Invoices><Invoice><Id idDomain="NG">681891</Id><SyncToken>3</SyncToken><MetaData><CreateTime>2013-04-18T03:13:26.796Z</CreateTime><LastUpdatedTime>2013-04-23T03:49:05.800Z</LastUpdatedTime></MetaData><ExternalKey idDomain="QB">1189</ExternalKey><Synchronized>true</Synchronized><Header><DocNumber>WEB000126</DocNumber><TxnDate>2013-02-28T00:00:00Z</TxnDate><Status>Paid</Status><CustomerId idDomain="QB">340</CustomerId><CustomerName>Test, Ray & Teryl</CustomerName><RemitToId idDomain="QB">340</RemitToId><RemitToName>Test, Ray & Teryl</RemitToName><ShipDate>2013-02-28T00:00:00Z</ShipDate><SubTotalAmt>375</SubTotalAmt><TaxRate>0</TaxRate><TaxAmt>0</TaxAmt><TotalAmt>375</TotalAmt><ToBePrinted>true</ToBePrinted><ToBeEmailed>false</ToBeEmailed><ARAccountId idDomain="QB">64</ARAccountId><ARAccountName>Accounts Receivable</ARAccountName><SalesTermId idDomain="QB">8</SalesTermId><SalesTermName>Due on 1st</SalesTermName><DueDate>2013-03-01T00:00:00Z</DueDate><BillAddr><Id idDomain="QB">00000000000001cg</Id><Line1>Ray & Teryl Test</Line1><Line2>3290 Test Test</Line2><City>Stone Mountain</City><CountrySubDivisionCode>GA</CountrySubDivisionCode><PostalCode>30087</PostalCode><Default>true</Default><Tag>Billing</Tag></BillAddr><ShipAddr><Id idDomain="QB">00000000000003rW</Id><Default>false</Default><Tag>Shipping</Tag></ShipAddr><BillEmail>Test#Test.com</BillEmail><Balance>0</Balance></Header><Line><Id idDomain="QB">1191</Id><Desc>Conservatory Registration Fee</Desc><Amount>125</Amount><Taxable>false</Taxable><ItemId idDomain="QB">14</ItemId><ItemName>Artios Conservatory</ItemName><ItemType>Service</ItemType><UnitPrice>125</UnitPrice><Qty>1</Qty><SalesTaxCodeId idDomain="QB">2</SalesTaxCodeId><SalesTaxCodeName>Non</SalesTaxCodeName></Line><Line><Id idDomain="QB">1192</Id><Desc>Preparatory Registration Fee</Desc><Amount>125</Amount><Taxable>false</Taxable><ItemId idDomain="QB">142</ItemId><ItemName>Elem Prep Reg (5/1-8/31)</ItemName><ItemType>Service</ItemType><UnitPrice>125</UnitPrice><Qty>1</Qty><SalesTaxCodeId idDomain="QB">2</SalesTaxCodeId><SalesTaxCodeName>Non</SalesTaxCodeName></Line><Line><Id idDomain="QB">1193</Id><Desc>Preparatory Registration Fee</Desc><Amount>125</Amount><Taxable>false</Taxable><ItemId idDomain="QB">142</ItemId><ItemName>Elem Prep Reg (5/1-8/31)</ItemName><ItemType>Service</ItemType><UnitPrice>125</UnitPrice><Qty>1</Qty><SalesTaxCodeId idDomain="QB">2</SalesTaxCodeId><SalesTaxCodeName>Non</SalesTaxCodeName></Line><Line><Id idDomain="QB">1194</Id><Desc>PayPal Convenience Fee</Desc></Line></Invoice></Invoices></RestResponse>

To add an answer for the question, there is no support for that specific filter in v2 of the API.
You'll need to filter within your application
thanks
Jarred

Related

Invoke-WebRequest returning unexpected results for some addresses

I seem to be having issues with certain addresses when trying to process with Invoke-WebRequest
The address below is one example of a few that I have come across.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(Invoke-WebRequest https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt).Content
(Invoke-WebRequest https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt).RawContent
The Content property seems to only return an Array of numbers. RawContent displays a result closer to what I would expect.
What is the reason for this?
Content
35
32
65
100
32
102
105
108
116
101
RawContent
HTTP/1.1 200 OK
x-amz-id-2: juI0bRXZacf19D5/sjmsw53XudBjlbSYtO0XKVQP0N+dWXvixKoWs8mV8oF23SLt8iGjaE/CKco=
x-amz-request-id: 5B68B280AD366CDE
Accept-Ranges: bytes
Content-Length: 43642
Content-Type:
Date: Fri, 13 Jul 2018 23:25:09 GMT
ETag: "0a43bd5ebd9b3e2ee08a205d163cb0ac"
Last-Modified: Wed, 09 Mar 2016 19:46:05 GMT
Server: AmazonS3
# Ad filter list by Disconnect
# License: GPLv3
# Contact: support [at] disconnect.me
htmlcontent
If you look at the headers, the Content Type is empty, therefore Invoke-WebRequest doesn't know what it's dealing with and treats the data as binary data (byte array).
(Invoke-WebRequest https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt).Headers
Key Value
--- -----
Accept-Ranges bytes
Content-Length 43642
Content-Type
Date Sat, 14 Jul 2018 02:28:36 GMT
ETag "0a43bd5ebd9b3e2ee08a205d163cb0ac"
Last-Modified Wed, 09 Mar 2016 19:46:05 GMT
Server AmazonS3
Whilst for example calling Invoke-WebRequest on this question:
(Invoke-WebRequest https://stackoverflow.com/questions/51333965/invoke-webrequest-returning-unexpecte
d-results-for-some-addresses).Headers
Key Value
--- -----
X-Frame-Options SAMEORIGIN
X-Request-Guid 9366c316-b9b3-467b-8911-b18bb4752e1c
Strict-Transport-Security max-age=15552000
Content-Security-Policy upgrade-insecure-requests
Age 0,0
Accept-Ranges bytes,bytes
Content-Length 108783
Cache-Control private
Content-Type text/html; charset=utf-8
…
EDIT: If you want to overrule the content-type you could do something like this:
$url = 'https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt'
[System.Net.HttpWebRequest]$req = [System.Net.WebRequest]::Create($url) -as [System.Net.HttpWebRequest]
[System.Net.HttpWebResponse]$resp = $req.getResponse()
$respStream = $resp.getResponseStream()
$sr = new-object IO.StreamReader($respStream)
$result = $sr.ReadToEnd()
$resp.Close()

PayPal REST API: trying to activate a billing plan, but getting "HTTP/1.1 401 Unauthorized"

I am building an EC site, where my customers can pay through PayPal API. Now, I am learning how it works, using Sandbox; referring to this page: https://developer.paypal.com/docs/integration/direct/billing-plans/
I have succeeded the prerequisites, i.e., having created a PayPal app,
gotten an access token, and made an API call. And then, I have succeeded making a billing plan, copying-and-pasting the sample command on the page, just replacing the Access Token.
Now, I want to activate the billing plan, but couldn't have succeeded.
The command used is, once again, copied-and-pasted from the page, as below.
curl -v -k -X PATCH https://api.sandbox.paypal.com/v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA/ \
-H 'X-PAYPAL-OAUTH-CONTEXT: {"consumer":{"accountNumber":1181198218909172527,"merchantId":"5KW8F2FXKX5HA"},"merchant":{"accountNumber":1659371090107732880,"merchantId":"2J6QB8YJQSJRJ"},"apiCaller":{"clientId":"AdtlNBDhgmQWi2xk6edqJVKklPFyDWxtyKuXuyVT-OgdnnKpAVsbKHgvqHHP","appId":"APP-6DV794347V142302B","payerId":"2J6QB8YJQSJRJ","accountNumber":"1659371090107732880"},"scopes":["https://api.paypal.com/v1/payments/.*","https://uri.paypal.com/services/payments/futurepayments","openid"]}' \
-H 'Content-Type: application/json' \
-d '[{
"op": "replace",
"path": "/",
"value": {
"state": "ACTIVE"
}
}]'
First, as instructed, I just replaced the Plan ID "P-7DC96732KA7763723UOPKETA" with mine, provided in the previous response for creating the plan.
* Trying 173.0.82.78...
* Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0)
* TLS 1.2 connection using TLS_RSA_WITH_AES_256_CBC_SHA256
* Server certificate: api.sandbox.paypal.com
* Server certificate: Symantec Class 3 Secure Server CA - G4
* Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
> PATCH /v1/payments/billing-plans/P-8AX21799EN516221GJMBOECA/ HTTP/1.1
> Host: api.sandbox.paypal.com
> User-Agent: curl/7.43.0
> Accept: */*
> X-PAYPAL-OAUTH-CONTEXT: {"consumer":{"accountNumber":1181198218909172527,"merchantId":"5KW8F2FXKX5HA"},"merchant":{"accountNumber":1659371090107732880,"merchantId":"2J6QB8YJQSJRJ"},"apiCaller":{"clientId":"AdtlNBDhgmQWi2xk6edqJVKklPFyDWxtyKuXuyVT-OgdnnKpAVsbKHgvqHHP","appId":"APP-6DV794347V142302B","payerId":"2J6QB8YJQSJRJ","accountNumber":"1659371090107732880"},"scopes":["ttps://api.paypal.com/v1/payments/.*","ttps://uri.paypal.com/services/payments/futurepayments","openid"]}
> Content-Type: application/json
> Content-Length: 78
>
* upload completely sent off: 78 out of 78 bytes
< HTTP/1.1 401 Unauthorized
< Date: Fri, 17 Feb 2017 12:18:47 GMT
< Server: Apache
< paypal-debug-id: c46e304b4bb46
< Paypal-Debug-Id: c46e304b4bb46
< Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D1880%26app%3Dplatformapiserv%26TIME%3D669689432%26HTTP_X_PP_AZ_LOCATOR%3D; Expires=Fri, 17 Feb 2017 12:48:47 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
< Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
< Content-Length: 0
< Connection: close
< Content-Type: text/plain; charset=ISO-8859-1
<
* Closing connection 0
And I tried with some other parameter replacements, like the Client ID, but no luck.
Do I need to replace other parameters?
Or, have I done something wrong?
SOLVED.
On this page, I found simpler and more straightforward command
and made up below:
curl -v -X PATCH https://api.sandbox.paypal.com/v1/payments/billing-plans/<Plan ID>/ \
-H "Content-Type:application/json" \
-H "Authorization: Bearer <Access Token>" \
-d '[
{
"path":"/",
"value":{"state":"ACTIVE"},
"op":"replace"}
]'
Got the response as below:
* Trying 173.0.82.78...
* Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0)
* TLS 1.2 connection using TLS_RSA_WITH_AES_256_CBC_SHA256
* Server certificate: api.sandbox.paypal.com
* Server certificate: Symantec Class 3 Secure Server CA - G4
* Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
> GET /v1/payments/billing-plans/<Plan ID> HTTP/1.1
> Host: api.sandbox.paypal.com
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type:application/json
> Authorization: Bearer <Access Token>
>
< HTTP/1.1 200 OK
< Date: Sun, 19 Feb 2017 11:36:50 GMT
< Server: Apache
< paypal-debug-id: 3ca31778e271e
< Content-Language: *
< Paypal-Debug-Id: 3ca31778e271e
< Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D1880%26app%3Dplatformapiserv%26TIME%3D1384360280%26HTTP_X_PP_AZ_LOCATOR%3D; Expires=Sun, 19 Feb 2017 12:06:52 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
< Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
< Vary: Authorization
< Content-Length: 1391
< Connection: close
< Content-Type: application/json
<
* Closing connection 0
{"id":"<Plan ID>","state":"ACTIVE","name":"Sample Plan",
...
"rel":"self","method":"GET"}]}
Got HTTP 200 and the state "ACTIVE".
Thanks for your trying to help, many thanks!

Why I am getting invalid_request from Graph api when invoked from my app?

When I make the following request from browser, it works.
https://graph.facebook.com/app?access_token=<a valid token>
However, this same call fails with the following error when done from my code, for the exact same token which worked in the browser.
2 * Client out-bound request
2 > GET https://graph.facebook.com/app?access_token=<the fb token>
2 * Client in-bound response
2 < 400
2 < Content-Type: text/javascript; charset=UTF-8
2 < WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"
2 < Access-Control-Allow-Origin: *
2 < X-FB-Rev: 1674690
2 < Pragma: no-cache
2 < Cache-Control: no-store
2 < Facebook-API-Version: v1.0
2 < Expires: Sat, 01 Jan 2000 00:00:00 GMT
2 < X-FB-Debug: <some string>
2 < Date: Mon, 06 Apr 2015 13:46:57 GMT
2 < Connection: keep-alive
2 < Content-Length: 183
2 <
{"error":{"message":"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100}}
My client-side code which makes this call is:-
ClientResponse r = httpClient.resource("https://graph.facebook.com/app")
.queryParam("access_token", fbAccessToken).accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
FBAccessTokenResponse res = r.getEntity(FBAccessTokenResponse.class);
return res;
The other interesting fact is that the app code works if the fb token is for me (the app developer) or few FB test users. For other actual users it fails with this error, for my app only.

Coldfusion: CFHTTP landing page redirection

I am working on a project that requires a CFHTTP call to book publishers that returns an excerpt from their site. My issue is that one of the publisher's URLS is converted to another and I can't seem to figure out how to get the returned information from them.
For example: The url I would visit is http://www.pubsite.com/bookID/99999
When I go to that site in the browser, it automatically redirects me to: http://www.pubsite.com/publisherID/12345
This is fine and I can see the information I need. However, when I try to automate this process using Coldfusion, I am stuck. There is no way to know what that publisherID is ahead of time.
My code is this:
<cfset thisURL = "http://www.pubsite.com/bookID/#Trim(arguments.BID)#">
<cfhttp method="get" url="#thisURL#" useragent="#CGI.http_user_agent#" result="objGet" redirect="true" resolveurl="true"/>
<cfdump var="#objGet#" />
Nothing in the returned dump (header or filecontent) indicates the publisherID, or the true landing URL, and I get a ResponseCode of 200 so I don't know what to do next.
After much Google searching, I'm stumped. Thanks for any insight!
EDIT TO INCLUDE DUMP:
struct
Charset UTF-8
ErrorDetail [empty string]
Filecontent
binary
6033687967848980
[truncated]
Header HTTP/1.1 200 OK X-Firenze-Processing-Time: 422.785 X-Firenze-Processing-Time: 626.552 X-Varnish-Cache: miss X-SmartBan-URL: /content/1177/0959683607085571 X-Firenze-Processing-Times: detect-robot: 0.315 X-Firenze-Processing-Times: add-external-dependencies-info: 0.033 X-Firenze-Processing-Times: content-pre-retrieve: 307.973 X-Firenze-Processing-Times: add-req-info: 10.427 X-Firenze-Processing-Times: authn-authz: 48.986 X-Firenze-Processing-Times: ac-info-request: 4.702 X-Firenze-Processing-Times: login-check: 2.104 X-Firenze-Processing-Times: last-authorized-identity: 1.769 X-Firenze-Processing-Times: retrieve-current-issue: 0.038 X-Firenze-Processing-Times: retrieve-content-page-content: 8.148 X-Firenze-Processing-Times: retrieve-content-page-prev: 3.260 X-Firenze-Processing-Times: retrieve-content-page-next: 3.310 X-Firenze-Processing-Times: retrieve-ads: 9.608 X-Firenze-Processing-Times: retrieve-session-data: 4.577 X-Firenze-Processing-Times: log-builder: 3.302 X-Firenze-Processing-Times: servlet: 207.151 Accept-Ranges: bytes X-XXXX-RequestId: VPTH5atDd2QAABNxM48AAAD- Vary: Accept-Encoding Connection: close X-XXXX-SessionId: m3H5rW2RVOiJ7qb3WTMt0w Set-Cookie: JSESSIONID=FF1AA7D6946D968D5E100C8FD1B8205C.wa126.XXXX.org; Path=/ Age: 0 Content-Type: text/html;charset=UTF-8 Server: nginx/0.7.67 X-Varnish: 2761793264 X-Varnish-Hostname: varnish8.XXXX.org X-SmartBan-Host: hol.XXXX.com x-XXXX-user: memno=1000480925; name=XXXX; type=INST; ip_access=true; password_access=true Date: Mon, 02 Mar 2015 20:28:21 GMT Via: 1.1 varnish
Mimetype text/html
Responseheader
struct
Accept-Ranges bytes
Age 0
Connection close
Content-Type text/html;charset=UTF-8
Date Mon, 02 Mar 2015 20:28:21 GMT
Explanation OK
Http_Version HTTP/1.1
Server nginx/0.7.67
Set-Cookie JSESSIONID=FF1AA7D6946D968D5E100C8FD1B8205C.wa126.XXXX.org; Path=/
Status_Code 200
Vary Accept-Encoding
Via 1.1 varnish
X-Firenze-Processing-Time
struct
1 422.785
2 626.552
X-Firenze-Processing-Times
struct
1 detect-robot: 0.315
10 retrieve-content-page-content: 8.148
11 retrieve-content-page-prev: 3.260
12 retrieve-content-page-next: 3.310
13 retrieve-ads: 9.608
14 retrieve-session-data: 4.577
15 log-builder: 3.302
16 servlet: 207.151
2 add-external-dependencies-info: 0.033
3 content-pre-retrieve: 307.973
4 add-req-info: 10.427
5 authn-authz: 48.986
6 ac-info-request: 4.702
7 login-check: 2.104
8 last-authorized-identity: 1.769
9 retrieve-current-issue: 0.038
X-XXXX-RequestId VPTH5atDd2QAABNxM48AAAD-
X-XXXX-SessionId m3H5rW2RVOiJ7qb3WTMt0w
X-SmartBan-Host hol.XXXX.com
X-SmartBan-URL /content/1177/0959683607085571
X-Varnish 2761793264
X-Varnish-Cache miss
X-Varnish-Hostname varnish8.XXXX.org
x-XXXX-user memno=1000480925; name=XXXX; type=INST; ip_access=true; password_access=true
Statuscode 200 OK
Text YES

Error in Basic-Authentication Login (406 Not Acceptable)

After implementing Basic-Authentication for my Jersey REST services, I'm implementing Authentication for my Client API using HTTPBasicAuthFilter.
I'm using Glassfish 3.1.2 and NetBeans.
I've followed the code written in http://javaevangelist.blogspot.pt/2012/07/jax-rs-tip-of-day-basic-client_27.html, and just changed the following parameters:
erc.setUsernamePassword("blive2", "microio") - this is the correct login
private static final String BASE_URI = "http://localhost:8080/LULServices/webresources"
webResource = client.resource(BASE_URI).path("entities.user")
So, when I run this file, the following message appears:
Mar 11, 2013 5:30:38 PM com.sun.jersey.api.client.filter.LoggingFilter log
INFO: 1 * Client out-bound request
1 > GET http://localhost:8080/LULServices/webresources/entities.user
1 > Accept: text/plain
1 > Authorization: Basic YmxpdmUyOm1pY3JvaW8=
Mar 11, 2013 5:30:38 PM com.sun.jersey.api.client.filter.LoggingFilter log
INFO: 1 * Client in-bound response
1 < 406
1 < Date: Mon, 11 Mar 2013 17:30:38 GMT
1 < Content-Length: 1231
1 < Expires: Thu, 01 Jan 1970 01:00:00 GMT
1 < Content-Type: text/html
1 < Server: GlassFish Server Open Source Edition 3.1.2.2
1 < X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.2.2 Java/Oracle Corporation/1.7)
1 < Cache-Control: no-cache
1 < Pragma: No-cache
1 <
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>GlassFish Server Open Source Edition 3.1.2.2 - Error report</title><style type="text/css"><!--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;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 406 - Not Acceptable</h1><hr/><p><b>type</b> Status report</p><p><b>message</b>Not Acceptable</p><p><b>description</b>The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers (Not Acceptable).</p><hr/><h3>GlassFish Server Open Source Edition 3.1.2.2</h3></body></html>
Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException: GET http://localhost:8080/LULServices/webresources/entities.user returned a response status of 406 Not Acceptable
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:686)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:507)
at lulClient.BasicAuthenticationClient$ExampleResourceClient.getMessage(BasicAuthenticationClient.java:38)
at lulClient.BasicAuthenticationClient.main(BasicAuthenticationClient.java:19)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
So it is the 406 Not Acceptable that appears.
Can you help me to solve it?
Thanks!
The problem is solved. The information I was asking to the service was just returned in two types: APPLICATION_JSON, or APPLICATION_XML. So I had to alter the part of the code where I inserted the type to:
javax.ws.rs.core.MediaType.APPLICATION_JSON or javax.ws.rs.core.MediaType.APPLICATION_XML.