I am trying to download a file content from SOAP API which is imported as an wsdl into my .net core project. I can see the response in the fiddler that file contents are coming back from API but in my .net code it is blank. Every other field in the response is coming back fine and it is just the content of the file getting striped out from response. Below is the code to download:
BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
basicHttpBinding.MaxBufferSize = 2147483647;
basicHttpBinding.MaxBufferPoolSize = 2147483647;
basicHttpBinding.MaxReceivedMessageSize = 2147483647;
basicHttpBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
basicHttpBinding.ReaderQuotas.MaxArrayLength = 2147483647;
basicHttpBinding.ReaderQuotas.MaxDepth = 32;
basicHttpBinding.ReaderQuotas.MaxBytesPerRead = 2147483647;
var wcfHostUri = new Uri(esbServiceOptions?.DocumentumServiceHost);
var endpoint = new Uri(wcfHostUri, esbServiceOptions?.RACQServiceFolderUrl);
var endpointAddress = new EndpointAddress(endpoint);
var client = new RACQ.PC.DocumentumService.RACQServicePortClient(basicHttpBinding, endpointAddress);
using (new OperationContextScope(client.InnerChannel))
{
var identitiesHeader = new ServiceContextHeader();
OperationContext.Current.OutgoingMessageHeaders.Add(identitiesHeader);
var document = client.retrieveDocumentAsync(new PC.DocumentumService.ObjectIdentitySet()
{
Identities = new[]
{
new ObjectIdentity
{
repositoryName = esbServiceOptions.RepositoryName,
valueType = ObjectIdentityType.OBJECT_ID,
valueTypeSpecified = true,
Item = new ObjectId
{
id = documentId
}
}
}
}, new OperationOptions()
{
Profiles = new Profile[]
{
new ContentTransferProfile
{
transferMode = ContentTransferMode.BASE64,
transferModeSpecified = true
},
new ContentProfile
{
urlReturnPolicy = UrlReturnPolicy.NEVER,
urlReturnPolicySpecified = true,
renditionTypeFilter = RenditionTypeFilter.ANY,
renditionTypeFilterSpecified = true,
pageModifierFilter = PageModifierFilter.ANY,
pageModifierFilterSpecified = true,
pageFilter = PageFilter.ANY,
pageFilterSpecified = true,
formatFilter = FormatFilter.ANY,
formatFilterSpecified = true
}
}
}, esbServiceOptions.DocumentUsername).GetAwaiter().GetResult();//Result;
var content = (BinaryContent)document.@return.DataObjects.First().Contents.First();
return content.Value; //this is null
The @content.Value is null in the above code. The below is that is in the fiddler you can clearly see that file is coming back for the same request I am capturing:
