SharePoint search service returns SERVER_ERROR (SQLException) - wcf

I have a simple WCF webservice client that sends a request to Microsoft Search Server (included with SharePoint 2007) on /more/_vti_bin/search.asmx
The request is sent
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Query xmlns="urn:Microsoft.Search">
<queryXml><QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000"> <Query> <Context> <QueryText language="fr-FR" type="STRING">foo bar</QueryText></Context> </Query> </QueryPacket> </queryXml>
</Query></s:Body></s:Envelope>
But the response shows a SQLException error
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<QueryResponse xmlns="urn:Microsoft.Search">
<QueryResult><ResponsePacket xmlns="urn:Microsoft.Search.Response"><Response domain=""><Status>ERROR_SERVER</Status><DebugErrorMessage>System.Data.SqlClient.SqlException</DebugErrorMessage></Response></ResponsePacket></QueryResult>
</QueryResponse></soap:Body></soap:Envelope>

It states there's been a sql exception, coulld you check on your sql machine if any errors occurred?

there is a problem with your request. test your search service using this tool

After some further analysis, I have understood that the problem lies in the fact that the Soap query does not start with an XML declaration.
<?xml version="1.0">
This is perfectly possible and respectful of standards but SharePoint doesn't like that.
The question becomes: How to force the WCF client to starts with an XML declaration.

Related

GetItem xml request using makeEwsRequestAsync() in Outlook for Mac has stopped returning a response

Outlook for Mac: 16.24 (19041401)
I'm making a getItem request using makeEwsRequestAsync in Outlook for Mac and the callback does not contain a response, (status == succeeded, value is null). The same request from OWA/Outlook 2016 contains a valid xml response. I'm using the GetItem request to retrieve a changekey.
Why is there a difference in behavior here?
XML GetItem request
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013"/>
</soap:Header>
<soap:Body>
<m:GetItem>
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:BodyType>Text</t:BodyType>
</m:ItemShape>
<m:ItemIds>
<t:ItemId Id="AAMkAGNlYjE1NWU4LTU1NmItNDdhYy04OTZiLWZmM2UwNjFkZjA1YwBGAAAAAACQR9mC/O1ETaOK/jgMPXmgBwCLsR3BxFcKQIBIOhhvOBA4AAAAAAEJAACLsR3BxFcKQIBIOhhvOBA4AAPI6G5DAAA="/>
</m:ItemIds>
</m:GetItem>
</soap:Body>
</soap:Envelope>
This was a known issue acknowledged by Outlook for mac team and it is fixed in newer version of Outlook.(16.26+)

Sonos applink based authentication issue

Trying to add out sonos service will show Authorize" screen for a fraction of a second before it goes away stating "account not found" before I even have time to put in an account. Below are the request for applink and resonse.
Any thing else is required to make it remain in the authorize screen
//request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.sonos.com/Services/1.1">
<soapenv:Header>
<ns:context>
</ns:context>
<ns:credentials>
</ns:credentials>
</soapenv:Header>
<soapenv:Body>
<ns:getAppLink>
<ns:householdId>Sonos_ghsAflSonosakevCzmxcmFhN7pN</ns:householdId>
<ns:hardware>iPhone8,2</ns:hardware>
<ns:osVersion>Version 9.3.3 (Build 13G34)</ns:osVersion>
<ns:sonosAppName>ICRU_iPhone8,2</ns:sonosAppName>
<ns:callbackPath>sonos://x-callback-url/addAccount?state=sid%3D61703%26OAuthDeviceID%3DSonos_ghsAflSonosakevCzmxcmFhN7pN%26callbackPath%3D%2FaddAccount</ns:callbackPath>
</ns:getAppLink>
</soapenv:Body>
</soapenv:Envelope>
//response
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<getAppLinkResponse xmlns="http://www.sonos.com/Services/1.1">
<getAppLinkResult>
<authorizeAccount>
<appUrlStringId>LAUNCH_APP</appUrlStringId>
<deviceLink>
<regUrl>https://ourserver.com/#/signin?callbackurl=sonos://x-callback-url/add…
<linkCode>Sonos_ghsAflSonosakevCzmxcmFhN7pN</linkCode>
<showLinkCode>false</showLinkCode>
</deviceLink>
</authorizeAccount>
</getAppLinkResult>
</getAppLinkResponse>
</soap:Body>
</soap:Envelope>
The experience you are describing is what would happen if you are not properly returning the ‘NOT_LINKED_RETRY’ fault.
As described in the documentation, https://musicpartners.sonos.com/node/405 (search for polling). While your service waits for the user to manually log in through the browser, it should provide to the getDeviceAuthToken call the ‘NOT_LINKED_RETRY’ fault response for a few minutes. Details for this fault can be found here: https://musicpartners.sonos.com/node/292.

WCF binding configuration for SalesForce Api

For an application i'm developing i need to make a call on the SalesForce api. With SvcUtil i generated a proxy and integrated this in my solution. After i made a call via code, i get the following request and exception response. I use a normal basicHttpBinding.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none"></Action>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink"></VsDebuggerCausalityData>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<login xmlns="urn:partner.soap.sforce.com">
<username>XXX</username>
<password>XXX</password>
</login>
</s:Body>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"></s:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns="">soapenv:Client</faultcode>
<faultstring xmlns="">No operation available for request {urn:partner.soap.sforce.com}login</faultstring>
</soapenv:Fault>
</soapenv:Body>
However, if call the service with SoapUI, i don't get any errors. After googling i tried to make some changes in the binding and created a custom binding for forcing the soap version to 1.2, but didn't find a good solution. What should i change in the binding configuration?
This is the SoapUI call:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com">
<soapenv:Body>
<urn:login>
<urn:username>XXXX</urn:username>
<urn:password>XXXX</urn:password>
</urn:login>
</soapenv:Body>
</soapenv:Envelope>
After some research i found out that creating a proxy using "Add service reference" creates a proxy that works. So my problem is solved. Still have to check what the difference is between the generated proxies.

How to solve the "cannot find soap action mapping for" soap api?

The request for soap api is given below
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WashOut"
<soapenv:Header/>
<soapenv:Body>
<urn:Activate_VAS_Request soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<OPER_NAME xsi:type="xsd:string">?</OPER_NAME>
<OPER_PASSWORD xsi:type="xsd:string">?</OPER_PASSWORD>
<MSISDN xsi:type="xsd:string">?</MSISDN>
<VAS_ID xsi:type="xsd:int">?</VAS_ID>
<PARAM_VAL xsi:type="xsd:string">?</PARAM_VAL>
</urn:Activate_VAS_Request>
</soapenv:Body>
</soapenv:Envelope>
and the response of the request is given below.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<faultcode xsi:type="xsd:QName">Server</faultcode>
<faultstring xsi:type="xsd:string">Cannot find SOAP action mapping for</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
which thing causing the error.
This error means WashOut is unable to find the requested action (in your particular case it fails to even parse it – it's empty string).
Also the wash_out version you use is critically old. Current one is 0.9.0. Please upgrade.
I've seen that some Soap clients send the request in a way wash_out can't infer the soapAction value, as a consequence it can't link the request to an action in the wash_out controller.
For having a working reference, I think you should try a soap client such as soapUI or Savon, I've seen they send the request in a way wash_out can infer which is the soapAction in the request.

Getting Unmarshalling Error while using Google Adwords API

I'm making use of OAuth2 as authentication mechanism to get the response about the "add budget campaign" using SOAP request. In the very beginning to send a soap request using cUrl I am facing an error given below:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>
Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'biddingStrategy'. One of '{"https://adwords.google.com/api/adwords/cm/v201309":conversionOptimizerEligibility, "https://adwords.google.com/api/adwords/cm/v201309":adServingOptimizationStatus, "https://adwords.google.com/api/adwords/cm/v201309":frequencyCap, "https://adwords.google.com/api/adwords/cm/v201309":settings, "https://adwords.google.com/api/adwords/cm/v201309":networkSetting, "https://adwords.google.com/api/adwords/cm/v201309":biddingStrategyConfiguration, "https://adwords.google.com/api/adwords/cm/v201309":forwardCompatibilityMap}' is expected.
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I am sending the following XML/SOAP request using cUrl which is the similar code given on AdWords tutorial (https://developers.google.com/adwords/api/docs/guides/soap) .
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="https://adwords.google.com/api/adwords/cm/v201309">
<soap:Header>
<RequestHeader>
<authToken>MYAUTHTOKEN</authToken>
<userAgent>curl-tutorial</userAgent>
<developerToken>MYDEVTOKEN</developerToken>
<clientCustomerId>MYCUSTOMERID</clientCustomerId>
</RequestHeader>
</soap:Header>
<soap:Body>
<mutate>
<operations>
<operator>ADD</operator>
<operand>
<name>Test File</name>
<budget>
<period>DAILY</period>
<amount>
<microAmount>1000000000</microAmount>
</amount>
<deliveryMethod>STANDARD</deliveryMethod>
</budget>
<biddingStrategy
xmlns:cm="https://adwords.google.com/api/adwords/cm/v201309"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="cm:ManualCPC"/>
<settings
xmlns:cm="https://adwords.google.com/api/adwords/cm/v201309"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="cm:KeywordMatchSetting">
<cm:optIn>false</cm:optIn>
</settings>
</operand>
</operations>
</mutate>
</soap:Body>
</soap:Envelope>
I utilized the above XML/SOAP request in my cUrl request as:
curl --header "Content-Type: application/soap+xml"
--data #test.xml https://adwords.google.com/api/adwords/cm/v201309/CampaignService
I have searched over the internet regarding the same issue I'm facing but no where I could find the solution. Please let me know if I'm doing anything wrong or let me know if there is any other way out.
Campaigns don't have biddingStrategies. They have biddingStrategyConfigurations. Take a look at the reference: https://developers.google.com/adwords/api/docs/reference/v201309/CampaignService.Campaign