KingswaySoft Upsert Bad Request - ssis

I am currently using KingswaySoft for ETL into Dynamics. We have a need for the upsert action for future trickle loading. Each time I use upsert on a entity (table in dynamics), that has data in it already, I am facing a bad request error.
[Dynamics CRM Destination [2]] Error: An error occurred with the following error message: "KingswaySoft.IntegrationToolkit.DynamicsCrm.CrmServiceException: CRM service call returned an error: The remote server returned an error: (400) Bad Request. (Error Type / Reason: BadRequest, Detailed Message: --batchresponse_a42eef80-4222-496c-8c69-ff6660222ef4
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 400 Bad Request
REQ_ID: a9868fb9-d02b-4595-a329-a855c92ced17
Content-Type: application/json; odata.metadata=minimal
OData-Version: 4.0
{"error":{"code":"0x80040265","message":"Unhandled Plugin Exception Object reference not set to an instance of an object."}}
--batchresponse_a42eef80-4222-496c-8c69-ff6660222ef4--
) (SSIS Integration Toolkit for Microsoft Dynamics 365, v21.1.0.1671 - DtsDebugHost, v15.0.2000.152)KingswaySoft.IntegrationToolkit.DynamicsCrm.WebAPI.WebApiServiceException
: The remote server returned an error: (400) Bad Request. (Error Type / Reason: BadRequest, Detailed Message: --batchresponse_a42eef80-4222-496c-8c69-ff6660222ef4
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 400 Bad Request
REQ_ID: a9868fb9-d02b-4595-a329-a855c92ced17
Content-Type: application/json; odata.metadata=minimal
OData-Version: 4.0
{"error":{"code":"0x80040265","message":"Unhandled Plugin Exception Object reference not set to an instance of an object."}}
--batchresponse_a42eef80-4222-496c-8c69-ff6660222ef4--
)System.Net.WebException
(Status Reason: BadRequest): The remote server returned an error: (400) Bad Request.".
I am manually specifying Record Matching Criteria on a primary key from the staging tables that does live on the records in Dynamics.

The error that you have received indicates that you have an unhandled null reference error in your custom code, you need to fix the error in your plugin code. Alternatively, you could turn on the "Tentatively Disable Relevant Plugins" option in the CDS/CRM destination component, in which case our software will tentatively disable your plugin while loading the data. In doing so, we do recommend you upgrade your software installation to the latest v21.2 release that we just made available last week. In the new release, there is the "Bypass Custom Business Logic" option which serves the purpose better by bypassing (not actually turning off or disabling) your custom plugins. We hope this helps, please give it a try and share the update with us if you need further assistance.

Related

Callout failed for invocable action in flow

I am trying to send an API request to the external service using flow in salesforce but when I debug my flow it returns the below error
Error Occurred: Callout failed for invocable action testing3.post-vacancy-id. Expected declared response media type application/json, but got application/problem+json; charset=utf-8 for operation post-vacancy-id and service testing3
I have not specified the content-type in the header (cause I don't know how to define that in the header in flow) but I found that it will take the default content-type as application/JSON and also I have checked the body of the API request it is work fine when sending it from the postman.
I have searched regarding this but didn't find anything on the web, any help will be appreciated here.
thanks!!

Recently I'm having CORS problems only in Google Chrome

Having some major CORS problems with Google Chrome lately:
Access to XMLHttpRequest at '...' from origin '...' has been blocked
by CORS policy: Response to preflight request doesn't pass access
control check: It does not have HTTP ok status.
The weird thing is that the request works perfectly on Mozilla Firefox.
I tried to add different headers to the server including:
Access-Control-Allow-Headers: Content-Type,Authorization,X-Requested-With,Accept,Access-Control-Request-Method,Origin,Access-Control-Request-Headers
Access-Control-Allow-Methods: GET, POST, DELETE, PUT,OPTIONS,HEAD
Access-Control-Allow-Origin: *
Also before the "CORS Block" there's an OPTIONS request method Google Chrome sends my server but here i get a 500 server error:
javax.servlet.ServletException: A MultiException has 4 exceptions.
They are:
javax.ws.rs.ProcessingException: Error creating a JAXBContext for wadl processing.
java.lang.IllegalStateException: Unable to perform operation: create on
org.glassfish.jersey.server.wadl.internal.WadlApplicationContextImpl
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of
org.glassfish.jersey.server.wadl.processor.WadlModelProcessor$OptionsHandler
errors were found
java.lang.IllegalStateException: Unable to perform operation: resolve on
org.glassfish.jersey.server.wadl.processor.WadlModelProcessor$OptionsHandler
org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:432)
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
com.isyndix.rest.CORSFilter.doFilter(CORSFilter.java:40)
Does this have anything to do with it?
Thanks in advance for your help and time.
Cheers!
So apparently it had something to do with the OPTIONS-preflight not being handled right in the server back-end.
I have implemented the OPTIONS method in the REST endpoint:
#OPTIONS
public Response options() {
return Response.ok().build();
}
Keep in mind this is not a very good way of handling the problem because you need to implement this for every endpoint in your API.
But I didn't find a better solution and this works for me.
Cheers!

SBL-EAI-04116:HTTP Internet Exception during 'Data Send': 'An error occurred in the secure channel support', code: '12157'

Integration Siebel - Google geocoding:
the URL requests sent directly from the browser:
https://maps.googleapis.com/maps/api/geocode/xml?address=Landsdorf%20Strasse,,Gr%C3%BCnewald,01945,Deutschland&key=API_key
where API_key = particular API key provided by Google during first registration
Such request is working correctly, the response with geo codes is returned into the browser screen.
However if the same request is sent via Siebel through BS: EAI HTTP Transport
The error is displayed:
SBL-EAI-04116:HTTP Internet Exception during 'Data Send': 'An error
occurred in the secure channel support', code: '12157'.
Described solutions on official Oracle support Web for that error are related to some missing certificate on external Server , (in our case Google Server)
This is a faily generic occuring at the Wininet layer during the SSL handshake.
And action should be: Throughly check the external webserver logs wih increased SSL tracing level on webserver.
but logically it does not make a sense, why URL request directly from the browser (same network) has been successfully sent and response was received
without using any certifications or similar stuff related to SSL handshake
Can someone help with it ?
Thank you
Best regards
I have a hunch here Siebel is sending data in UTF-16 format, and end point is rejecting it. Please check your outgoing trace messages.

SQL Server Service Broker system error -9616, when can it happen?

I have a scenario in one of my Service Broker conversation configurations, which looks like this:
one message type, which is sent by initiator only (VALIDATION = WELL_FORMED_XML, no XSD)
one contract with this message type
both deployed on the initiator and target side (remote machines)
Occasionally I find Service Broker system error messages in the target queue like this:
<Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-9616</Code><Description>A message of type 'here_is_the_name' was received and failed XML validation. XML parsing: line 1, character 547, illegal xml character This occurred in the message with Conversation ID 'here_is_the_guid', Initiator: 1, and Message sequence number: 0.</Description</Error>
I looked at Remus Rusanu's blog post and he states that:
This system error is sent to a conversation that has sent a message type marked as conforming to a certain XML schema but the payload has failed to pass the XML validation for the said schema
In my case there is no XML schema involved and I was trying to reproduce this case in my dev env using the same SQL Server versions and I was unable to do it.
I would like to know is it possible to receive this system error message although I'm not using XSD schema ? If so, when can it happen, what is the scenario where Service Broker generates error like above?
The message clearly says "XML parsing: line 1, character 547, illegal xml character" so in my opinion it has nothing to do with the schema validation.
Can it be that the transport level is encountering some problems (TCP errors) and that is why Service Broker is generating this error message ?
Message validation occurs on enqueue the message in the target queue, not on SEND. Message type validation (NONE, XML, XDS) is provided to protect your application. Validating during SEND is not enough, as a malicious application can send a message w/o using Service Broker ( a wire protocol simulator). Since validation during enqueue is mandatory, adding validation during SEND would add CPU burden for little value.
So what that means is the your SEND side application is sending invalid XML, and this gets caught on the target side. The wording on my blog is poorly chosen, I should had been more explicit that the validation can fail a schema (if specified) or it can fail the well formed XML test.
Can you post the message body you're sending?

Should HTTP Status be used in Restful Error Responses?

I'm writing a Restful API and I have to return error message but I'm not sure on which route to go.
Route 1 - HTTP Status
Use HTTP error status when the client sends bad data
Ex: 401 - Not authorized, 410 - Model does not exist, 412 - Model Validaiton Error, etc
Route 2 - JSON Success or Error Failure
The API returns json and I am considering returning everything with the http header 200, but then in my JSON handle errors and success
Ex:
{ "status" : "error", "message" : "Model validation error", "data" : ["user name required", "user email required"] }
Which route should I go and why? Advantages and disadvantages.
I'm writing a Restful API and I have to return error message but I'm
not sure on which route to go.
Route 1 - HTTP Status
Use HTTP error status when the client sends bad data
HTTP status codes should absolutely be used in any web service implementation claiming to be RESTful. The core principle of the specification is leveraging and extending the Web to fully support transfer of representational state. To allow for interoperation with existing Web infrastructure a REST implementation should indicate status of requests via appropriate HTTP status codes. For example:
200 - Ok
201 - Content Created
401 - Unauthorized
403 - Forbidden
500 - Server Error
501 - Not Implemented
When responding with many of these statuses, its also allowed by the HTTP specification to include an entity representation in the response body. In the case of 'normal', non-error responses, this representation will normally be of the entity that is being 'operated' on by the HTTP request. In the case of error responses the representation, if included, should provide more information on the error that occurred. This is where we segue to your option 2.
Route 2 - JSON Success or Error Failure
The API returns json and I am considering returning everything with
the http header 200, but then in my JSON handle errors and success
You should absolutely not return a 200 OK for all responses. Many well implemented HTTP clients depend on the status code in the response to determine wether it succeeded or not. Always responding with a 200 OK can cause third party client libraries to incorrectly process the incoming data, and also puts a requirement on your client to parse the response body in order to determine if an error actually happened or not.
Having said that, adding additional information about the error that occurred can be very helpful, so definitely do consider adding it to the response body. Your proposed format looks just fine, though to be honest the status element is redundant, assuming you use HTTP status codes appropriately. Something more like:
{
"message": "Model validation error",
"data": [
"user name required",
"user email required"
]
}