Problems with Autodiscover request : 'GetUserSettings' - outlook

The request to
POST autodiscover-s.outlook.com/autodiscover/autodiscover.xml
Content-Type: text/xml; charset=utf-8
Accept: text/xml; charset=utf-8
BODY
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:a="http://schemas.microsoft.com/exchange/2010/Autodiscover"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<a:RequestedServerVersion>Exchange2010</a:RequestedServerVersion>
<wsa:Action>http://schemas.microsoft.com/exchange/2010/Autodiscover/Autodiscover/GetUserSettings</wsa:Action>
<wsa:To>https://outlook.com/autodiscover/autodiscover.svc</wsa:To>
</soap:Header>
<soap:Body>
<a:GetUserSettingsRequestMessage xmlns:a="http://schemas.microsoft.com/exchange/2010/Autodiscover">
<a:Request>
<a:Users>
<a:User>
<a:Mailbox>test#test_test.onmicrosoft.com</a:Mailbox>
</a:User>
</a:Users>
<a:RequestedSettings>
<a:Setting>UserDisplayName</a:Setting>
<a:Setting>UserDN</a:Setting>
<a:Setting>UserDeploymentId</a:Setting>
<a:Setting>InternalMailboxServer</a:Setting>
<a:Setting>MailboxDN</a:Setting>
<a:Setting>ActiveDirectoryServer</a:Setting>
<a:Setting>CasVersion</a:Setting>
<a:Setting>EwsSupportedSchemas</a:Setting>
</a:RequestedSettings>
</a:Request>
</a:GetUserSettingsRequestMessage>
</soap:Body>
</soap:Envelope>
I got the response :
<?xml version="1.0" encoding="utf-8"?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
<Response>
<Error Time="16:03:30.0909591" Id="4042903973">
<ErrorCode>600</ErrorCode>
<Message>Invalid Request</Message>
<DebugData />
</Error>
</Response>
</Autodiscover>
I do not know what is wrong. I tried a lot of endpoints and different schemas in the body, but still nothing. Can anyone help me with solving such a problem?

Your submitting a SOAP request to the POX (Plain old XML endpoint) you need to submit the SOAP request to autodiscover-s.outlook.com/autodiscover/autodiscover.svc which is the SOAP endpoint.

I've test your code.
Did you valid your parameter for this?
<a:Users>
<a:User>
<a:Mailbox>test#test_test.onmicrosoft.com</a:Mailbox>
</a:User>
</a:Users>
<a:RequestedSettings>
<a:Setting>UserDisplayName</a:Setting>
<a:Setting>UserDN</a:Setting>
<a:Setting>UserDeploymentId</a:Setting>
<a:Setting>InternalMailboxServer</a:Setting>
<a:Setting>MailboxDN</a:Setting>
<a:Setting>ActiveDirectoryServer</a:Setting>
<a:Setting>CasVersion</a:Setting>
<a:Setting>EwsSupportedSchemas</a:Setting>
</a:RequestedSettings>
</a:Request>
If your request parameter correct, you can refer to this link:
Quick way to Fix AutoDiscover Error Code 600 in Exchange

Related

When I try to retrieve the Attachment by ID, I get an ErrorItemNotFound response

My problem seems to be to a permission error. When I try to retrieve the Attachment by ID using an EWS Soap request, I get an ErrorItemNotFound response.
So I'm roughly following the GetAttachment Example from Microsoft -- http://learn.microsoft.com/en-us/outlook/add-ins/get-attachments-of-an-outlook-item
My WebService that receives the EWS Token, EWS URL, and Attachment ID is written in Python.
Here is what I have working.
I have an Outlook AddIn written in Javascript that responds to mail item selections.
I retrieve an EWS Token using the isRest=false option and
Office.context.mailbox.getCallbackTokenAsync(getEWSCallback,
options);
For mail that has an attachment, I extract information about the attachment including the attachment Id.
Here is a sample of the attachment information:
{
"id":
"XZkADdlMDAxOTFiLWZmMWYtNGI1Ni1iYmM2LTlhOTJjYTBmMTI1MQBGAAAAAAAO1b910PexQpLkqgde51DABwAyR2+p4hG4RbXOV7pJuYtiAAAAAAEMAAAyR2+p4hG4RbXOV7pJuYtiAABsXaGoAAABEgAQAJ8Lans/ZeZLrkpk6mQ/QQg=",
"name":
"xxxxxxxxxxx.docx",
"contentType":
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size":
162008,
"attachmentType":
0,
"isInline":
false
}
I pass the EWS Token, EWS Url, and Attachment information to my webservice; which is written in Python.
My WebService constructs the soap request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="https://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<GetAttachment xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<AttachmentShape/>
<AttachmentIds>
<t:AttachmentId Id="XZkADdlMDAxOTFiLWZmMWYtNGI1Ni1iYmM2LTlhOTJjYTBmMTI1MQBGAAAAAAAO1b910PexQpLkqgde51DABwAyR2+p4hG4RbXOV7pJuYtiAAAAAAEMAAAyR2+p4hG4RbXOV7pJuYtiAABsXaGoAAABEgAQAJ8Lans/ZeZLrkpk6mQ/QQg="/>
</AttachmentIds>
</GetAttachment>
</soap:Body>
</soap:Envelope>
I then send a Webrequest with python:
authHeaders = {
'Authorization':
"Bearer " + ewsToken,
'Content-type':
'text/xml; charset=utf-8'
}
webResp = requests.post(url=ewsUrl, headers=authHeaders, data=requestString)
The response I get is below:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo
MajorVersion="15"
MinorVersion="20"
MajorBuildNumber="2430"
MinorBuildNumber="27"
Version="V2018_01_08"
xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:GetAttachmentResponse
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetAttachmentResponseMessage
ResponseClass="Error">
<m:MessageText>The specified object was not found in the store., The process failed to get the correct properties.</m:MessageText>
<m:ResponseCode>ErrorItemNotFound</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Attachments/>
</m:GetAttachmentResponseMessage>
</m:ResponseMessages>
</m:GetAttachmentResponse>
</s:Body>
</s:Envelope>
My understanding is that the ErrorItemNotFound response indicates either (1) The item doesn't exists or (2) I don't have permission to access it.
If I use a corrupt EWS Token, I get a Http 401 error that indicates I'm not authorized to make the EWS Post. So I believe the Bearer authentication is working correctly.
Any thoughts or help?

Server did not recognize the value of HTTP Header SOAPAction with net/http

I want to use the GetInfoByZIP servide of this WSDL http://www.webservicex.net/uszip.asmx?WSDL using net/http but always get the error "Server did not recognize the value of HTTP Header SOAPAction"
path = '/uszip.asmx'
#http://www.webservicex.net/uszip.asmx?WSDL
# Create the SOAP Envelope
data = <<-EOF
<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>
<GetInfoByZIPResponse xmlns="http://www.webserviceX.NET">
<GetInfoByZIPResult>
<NewDataSet xmlns="">
<Table>
<CITY>Beverly Hills</CITY>
<STATE>CA</STATE>
<ZIP>90210</ZIP>
<AREA_CODE>310</AREA_CODE>
<TIME_ZONE>P</TIME_ZONE>
</Table>
</NewDataSet>
</GetInfoByZIPResult>
</GetInfoByZIPResponse>
</soap:Body>
</soap:Envelope>EOF
host = "www.webservicex.net"
http = Net::HTTP.new(host)
resp = http.post(path, data, { 'Content-Type' => 'text/xml; charset=utf-8', 'SOAPAction' => 'GetInfoByZIP' })
Can anyone help me?
Thanks
The soapAction seems incorrect.
Try using the complete soapAction as specified in the example here:
http://www.webservicex.net/uszip.asmx?op=GetInfoByZIP
POST /uszip.asmx HTTP/1.1
Host: www.webservicex.net
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.webserviceX.NET/GetInfoByZIP"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetInfoByZIP xmlns="http://www.webserviceX.NET">
<USZip>string</USZip>
</GetInfoByZIP>
</soap:Body>
</soap:Envelope>
Change your code as follows:
resp = http.post(path, data, { 'Content-Type' => 'text/xml; charset=utf-8', 'SOAPAction' => 'http://www.webserviceX.NET/GetInfoByZIP' })

Creating Multiple Transactions based on Request

I'm mocking out a soap webservice and I can only get the default first response to return regardless of the request body.
I'm basing my attempts off the docs Multiple Transaction Examples and I'm confused as to what I'm doing wrong.
As an example:
+ Request
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="">
<SOAP-ENV:Body>
<m:transaction-identity-verification xmlns:m="">
</m:transaction-identity-verification>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
+ Response
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="">
<env:Header />
<env:Body>
<java:transaction-response xmlns:java="j">
<transaction-status>
<transaction-id>third_8020750179321</transaction-id>
<transaction-request-id>george_8020860578800</transaction-request-id>
<accounts-transaction-id>13</accounts-transaction-id>
<reference-id>13</reference-id>
<transaction-result>questions</transaction-result>
</transaction-status>
</java:transaction-response>
</env:Body>
</env:Envelope>
+ Request
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="">
<SOAP-ENV:Body>
<m:transaction-continue xmlns:m="">
</m:transaction-continue>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
+ Response
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="">
<env:Header/>
<env:Body>
<java:transaction-response xmlns:java="">
<transaction-status>
<transaction-id>cont_1_11020785803682</transaction-id>
<transaction-request-id>11020943348626</transaction-request-id>
<accounts-transaction-id>0</accounts-transaction-id>
<transaction-result>passed</transaction-result>
</transaction-status>
</java:transaction-response>
</env:Body>
</env:Envelope>
In the example above, I will only receive the first response even when I post two different requests. Based on the linked documentation this should be possible.
The Apiary mock-server does not have the capability to determine which response to return from multiple transaction examples based on the body of your request.
API Blueprint does allow you to provide multiple responses, Apiary mock server will only use response-code, headers or content-type to differentiate these examples.
For example, given two responses with different content-types:
+ Response 200 (plain/text)
Text Response
+ Response 200 (application/json)
{ "text": "JSON Response" }
Now, when we make a request to the mock server for the above responses. We can supply an Accept header to get the JSON response:
$ curl -H 'Accept: application/json' URL
{ "text": "JSON Response" }
Or ask for the text response:
$ curl -H 'Accept: plain/text' URL
Text Response
You can find more information regarding this at http://support.apiary.io/knowledgebase/articles/117119-handling-multiple-actions-on-a-single-resource

Bing Translation Api access via SOAP interface from Ruby

I'm trying to use Bing Translator SOAP API (due to in HTTP API I'm getting 414 "Request too long" for not so big requests due to UTF-8 serialization).
So, I'm playing with bing_translator gem source trying to switch it from HTTP inerface to SOAP one using Savon SOAP toolkit.
My workflow as follows (access token getting function not shown):
WSDL_URI = 'http://api.microsofttranslator.com/V2/soap.svc?wsdl'
get_access_token
client = Savon.client(wsdl: WSDL_URI, headers: {'Authorization' => "Bearer #{#access_token['access_token']}"})
params = {
'from' => 'ru',
'to' => 'en',
'text' => 'Это текст для перевода',
'category' => 'general',
'contentType' => 'text/plain'
}
result = client.call(:translate, message: params)
Then SOAP request executes:
SOAP request: http://api.microsofttranslator.com/V2/soap.svc
Authorization: Bearer http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=invest_amurobl_ru&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&Audience=http%3a%2f%2fapi.microsofttranslator.com&ExpiresOn=1381128612&Issuer=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&HMACSHA256=Mw41PMMgw2n6ZVaGRXtwfR0vwMJUyIMltIyd9pa9MqA%3d
SOAPAction: "http://api.microsofttranslator.com/V2/LanguageService/Translate"
Content-Type: text/xml;charset=UTF-8
Content-Length: 454
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://tempuri.org/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<wsdl:Translate>
<to>en</to>
<text>Это текст для перевода</text>
<category>general</category>
<contentType>text/html</contentType>
<from>ru</from>
</wsdl:Translate>
</env:Body>
</env:Envelope>
And I'm getting error 500: Unhandled Service Exception
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring xml:lang="en-US">Unhandled Service Exception</faultstring>
<detail>
<int xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1</int>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
What's may be wrong? Can anyone who already using Bing Translator SOAP API to diff my soap-messages with yourself? Any advices to how to troubleshoot this.
Thanks for attention.
EDIT:
I've checked API with SoapUI, as #SteffenRoller advices and it works. Here is XML generated by SoapUI (values are inserted by hand):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://api.microsofttranslator.com/V2">
<soapenv:Header/>
<soapenv:Body>
<v2:Translate>
<!--Optional:-->
<v2:text>Текст, который я хочу перевести</v2:text>
<!--Optional:-->
<v2:from>ru</v2:from>
<!--Optional:-->
<v2:to>en</v2:to>
<!--Optional:-->
<v2:contentType>text/plain</v2:contentType>
<!--Optional:-->
<v2:category>general</v2:category>
</v2:Translate>
</soapenv:Body>
</soapenv:Envelope>
As you can see the only difference is that all the tags inside a <Body> are in the v2 namespace. In the XML, generated by Savon this namespace isn't present at all.
So, now question is: How to instruct Savon to use correct namespace for tags inside the message body?
Although, I think, this is a Savon bug, I'll file it to developers, as SoapUI have generated correct XML by the same WSDL, and Savon doesn't.
Okay. This is a known bug: Savon issue #340. It's related to composite WSDL files and won't bi fixed in current major release :-(
So, in our case we need to tell Savon, what is our namespace is, what is it's name (just to align it with WSDL) and prepend each tag's name with this namespace.
The correct code looks like this:
require 'savon'
access_token = "http%3a%2f%2fschemas.xmlsoap.org%2fws...CA9TEs%3d"
client = Savon.client(
wsdl: 'http://api.microsofttranslator.com/V2/soap.svc?wsdl',
namespace: 'http://api.microsofttranslator.com/V2',
namespace_identifier: :v2,
headers: {'Authorization' => "Bearer #{access_token}"},
)
params = {
'v2:text' => 'Это текст для перевода',
'v2:from' => 'ru',
'v2:to' => 'en',
'v2:contentType' => 'text/plain',
'v2:category' => 'general',
}
result = client.call(:translate, message: params)
puts result.body[:translate_response][:translate_result]
Any advices and corrections are welcome. Thanks.

Magento SOAP API - Invalid XML fault(reindex())

I implemented a reindex API call. For an category index, it works as expected. For a product index (which takes about 3 min. to process), a process is started, but after approx. 45 seconds, I get a response "Invalid XML".
As it looks like, there is a problem of execution time. I did change a parameter max_execution_time to 600 (seconds). I enabled logging, but get no exception or error. In index management GUI, I see that reindex process started and is finished successfully 2 minutes after a response (Invalid XML) is returned (total reindex time is approx. 3 min).
A code of an API looks ok, because I can update all indexes, except product price and product flat data.
Any idea?
using wireshark:
Request:
POST /index.php/api/v2_soap/index/ HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3053)
VsDebuggerCausalityData: uIDPo6o2uSDL0oVKpqKJjDrFPsEAAAAAJt2oK8A51UOeAJsKkziyy/q2t81fNIxMnAvF+VaT7jIACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:Mage_Api_Model_Server_V2_HandlerAction"
Host: XXXXXXXXXXX(hidden for a security reason
Content-Length: 609
Expect: 100-continue
HTTP/1.1 100 Continue
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:Magento" xmlns:types="urn:Magento/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:iwCoreIndexingReindexById>
<sessionId xsi:type="xsd:string">835cfa019572c1a893b3799eecbc6903</sessionId>
<indexId xsi:type="xsd:int">4</indexId>
</tns:iwCoreIndexingReindexById>
</soap:Body>
</soap:Envelope>
Response(after 39 seconds!)
HTTP/1.1 500 Internal Service Error
Date: Fri, 18 May 2012 20:50:22 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Content-Length: 269
Connection: close
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>Sender</faultcode>
<faultstring>Invalid XML</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
State of index is processing. So a call is invoked and an action is also in a progress. Api.php looks like(this code is execuded and no exception is logged):
public function indexingReindexById( $indexId ){
$process = Mage::getModel('index/process')->load($indexId);
try{
$process->reindexAll();
} catch(exception $e){
Mage::Log($e->getMessage());
return false;
}
return true;
}
Changing a provider did a job. So it was a server issue.

Resources