CopyIntoItems Sharepoint SOAP Action Parameters - sharepoint

I am trying to upload a file using SOAP Action
POST /_vti_bin/Copy.asmx HTTP/1.1
Host: my.hostname.net
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"
<?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>
<CopyIntoItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<SourceUrl>string</SourceUrl>
<DestinationUrls>
<string>string</string>
<string>string</string>
</DestinationUrls>
<Fields>
<FieldInformation Type="Invalid or Integer or Text or Note or DateTime or Counter or Choice or Lookup or Boolean or Number or Currency or URL or Computed or Threading or Guid or MultiChoice or GridChoice or Calculated or File or Attachments or User or Recurrence or CrossProjectLink or ModStat or AllDayEvent or Error" DisplayName="string" InternalName="string" Id="guid" Value="string" />
<FieldInformation Type="Invalid or Integer or Text or Note or DateTime or Counter or Choice or Lookup or Boolean or Number or Currency or URL or Computed or Threading or Guid or MultiChoice or GridChoice or Calculated or File or Attachments or User or Recurrence or CrossProjectLink or ModStat or AllDayEvent or Error" DisplayName="string" InternalName="string" Id="guid" Value="string" />
</Fields>
<Stream>base64Binary</Stream>
</CopyIntoItems>
</soap:Body>
</soap:Envelope>
I wish to upload a PDF file or Doc file. I am using Firefox extension Poster
I have the source and destination URLs
What should be the values of <FieldInformation> and <Stream> ?
Thanks in advance
Viv

The stream value needs to be the base64binary representation of the file. So for example I have a text file that contains the text "123". Using this site http://www.base64converter.com/ I converted the text to base64 which translated to "MTIz". So if I was trying to upload my file I would put "MTIz" (without quotes) into the Stream tag. Something like this:
<Stream>MTIz</Stream>
The FieldInformation tags need to contain any SharePoint properties that need to be associated with the document you are uploading. So if you want to set the title property to "My Document" you would need something like this:
<FieldInformation Type="Text" DisplayName="Title" InternalName="Title" Id="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Value="My Document" />

Related

hexadecimal format for message IS08583 in the server side

Actually i'm working with iso 8583 messages, and library j8583 in java.
I created a echo (0800) message to probe connection with the server, the message looks good when is printed, but in the server side the message looks like hexadecimal encoding, something like this:
The devs in the server side told me is a format error for message, the correct message will be like this:
I see the correct message format are transmitted clearly like above image.
Factory from xml field:
this.messageFactory = ConfigParser.createFromClasspathConfig("j8583-config.xml");
Iso message setting binary flags
req.setBinaryFields(true);
req.setBinaryHeader(true);
XML configuration:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE j8583-config PUBLIC "-//J8583//DTD CONFIG 1.0//EN" "http://j8583.sourceforge.net/j8583.dtd">
<j8583-config>
<!-- These are the ISO headers to be prepended to the message types specified -->
<header type="0800">6000050000</header>
<header type="0810">6000050000</header>
<template type="0800">
<field num="3" type="NUMERIC" length="6" />
<field num="7" type="DATE10" />
<field num="11" type="NUMERIC" length="6" />
<field num="24" type="NUMERIC" length="3" />
<field num="41" type="ALPHA" length="8" />
<field num="42" type="ALPHA" length="15" />
<field num="60" type="LLLLVAR" length="" />
</template>
<parse type="0800">
<field num="3" type="NUMERIC" length="6" />
<field num="7" type="DATE10" />
<field num="11" type="NUMERIC" length="6" />
<field num="24" type="NUMERIC" length="3" />
<field num="41" type="ALPHA" length="8" />
<field num="42" type="ALPHA" length="15" />
<field num="60" type="LLLLVAR" length="" />
</parse>
</j8583-config>
IsoMessage build:
final IsoMessage req = this.messageFactory.newMessage(NET_INFO_REQUEST.getValue());
req.setValue(PROCESSING_CODE, ECHO.getValue(), IsoType.NUMERIC, 6);
req.setValue(TRANSMISSION_DATE_TIME, FormatUtils.formatDate10GMT0(new Date()), IsoType.DATE10, 0);
req.setValue(SYSTEM_TRACE_AUDIT_NO, leftPad(simpleTraceGenerator.nextTrace(), 6), IsoType.NUMERIC, 6);
req.setValue(INTERNATIONAL_NETWORK_ID, command.VISA.getCode(), IsoType.NUMERIC, 4);
req.setValue(TERMINAL_ID, "72024092", IsoType.ALPHA, 8);
req.setValue(CLIENT_CODE, "03659307 ", IsoType.ALPHA, 15);
req.setValue(SOFTWARE_VERSION, "OPv1", IsoType.LLLLVAR, 0);
req.setBinary(fale);
Can help me?
Seems there's more than one problem with the message you're generating:
You set fields and headers to binary, but the bitmap is still encoded in ASCII. You should probably just call setUseBinaryMessages instead, IIRC it sets all the messages flags to binary (bitmap, headers, fields). If it doesn't then you need to set binary bitmap programmatically (there's another method for that).
You have a message header for the 0800 but from the hexdump that the other side expects, it seems it's either very different (probary binary, BCD encoded) or they don't expect a header at all. If you need a binary header, specify it in the config (binary header content should be specified as hex, e.g. <header type="800" binary="true">60011200</header>) or you can set it programatically.
For the BCD-encoded fields, just use NUMERIC fields; the values will be BCD-encoded when using binary format. Same goes for DATE fields. LVAR fields are encoded as text; if you need binary data in those, then use LBIN instead. The binary equivalent of ALPHA is BINARY.
LBCDBIN fields are only useful if you message is ASCII-encoded but you need a LBIN field with BCD-encoded length header, because the length header encoding is otherwise chosen based on the encoding of the message (BCD for binary messages, ASCII otherwise).
Hope that helps!

How to get the required values from the below mentioned xml file?

1) i want to read below mentioned XML file and access the values, i already tried in many ways but not able to access, for example i want 'NightRaidPerformanceCPUScore' value and that is from which passIndex.
<?xml version='1.0' encoding='utf8'?>
<benchmark>
<results>
<result>
<name />
<description />
<passIndex>-1</passIndex>
<sourceId>C:\Users\dgadhipx\Documents\3DMark\3dmark-autosave-20200401155825.3dmark-result</sourceId>
<NightRaidPerformance3DMarkScore>2066</NightRaidPerformance3DMarkScore>
<NightRaidPerformanceCPUScore>1454</NightRaidPerformanceCPUScore>
<NightRaidPerformanceGraphicsScore>2233</NightRaidPerformanceGraphicsScore>
<benchmarkRunId>8045dec5-e97c-452b-abeb-54af187fd50a</benchmarkRunId>
</result>
<result>
<name />
<description />
<passIndex>0</passIndex>
<sourceId>C:\Users\dgadhipx\Documents\3DMark\3dmark-autosave-20200401155825.3dmark-result</sourceId>
<NightRaidPerformanceCPUScoreForPass>1454</NightRaidPerformanceCPUScoreForPass>
<NightRaidPerformance3DMarkScoreForPass>2066</NightRaidPerformance3DMarkScoreForPass>
<NightRaidPerformanceGraphicsScoreForPass>2233</NightRaidPerformanceGraphicsScoreForPass>
<NightRaidPerformanceGraphicsTest1>9.57</NightRaidPerformanceGraphicsTest1>
<NightRaidPerformanceGraphicsTest2>12.18</NightRaidPerformanceGraphicsTest2>
<NightRaidCpuP>395.2</NightRaidCpuP>
<benchmarkRunId>8045dec5-e97c-452b-abeb-54af187fd50a</benchmarkRunId>
</result>
</results>
</benchmark>
You can use BeautifulSoup as fellow:
with open(file_path, "r") as f:
content = f.read()
xml = BeautifulSoup(content, 'xml')
elements = xml.find_all("NightRaidPerformanceCPUScore")
for i in elements:
print(i.text)
That will print you the values of all "NightRaidPerformanceCPUScore" tags.

Converting XML to string and back to XML retaining the comments and order of the tags as it is

I have an XML and it contains a tag which has a value I want to replace in nodeJS.
The XML contains comments and attributes to the tags.
Most parsers convert the XML to JSON and do the replace in the process of which, the comments get lost in the final file.
So I thought of doing a XML to string conversion and replace and then back to XML.
I am unable to convert the string back to XML as many existing libraries in node either are converting to JSON, are unable to to parse attributes with ':' in it.
So any Solution for the same is appreciated.
N.B - the XML needs to be exactly the same as earlier in exception to only the one tag value I replace.
The order of the tags and the comments are important as there is a checksum calculation involved.
Sample Input :
<?xml version="1.0" encoding="UTF-8"?>
<session abc:def ="dines/dwivedi.../nodeJS/developer" name="Dinesh_Dwivedi"
samp1:display="sample/text1"
samp2:display="sample/text2"
samp3:display="sample/text3">
<view name="viewer/name1" type="good.sample.data1">
<feature ="text1" value="1:1"/>
<!--This is a sample comment-->
</view>
<view name="viewer/name2" type="good.sample.data2">
<feature ="text2" value="1:2"/>
<!--This is a sample comment too-->
</view>
<!--again another Sample comment-->
</session>
Text to change - Dinesh_Dwivedi
Replace Text - Dines_Dwivedi
Final Output -
<?xml version="1.0" encoding="UTF-8"?>
<session abc:def ="dines/dwivedi.../nodeJS/developer" name="Dines_Dwivedi"
samp1:display="sample/text1"
samp2:display="sample/text2"
samp3:display="sample/text3">
<view name="viewer/name1" type="good.sample.data1">
<feature ="text1" value="1:1"/>
<!--This is a sample comment-->
</view>
<view name="viewer/name2" type="good.sample.data2">
<feature ="text2" value="1:2"/>
<!--This is a sample comment too-->
</view>
<!--again another Sample comment-->
</session>

spring integration xpath namespace issue

I am trying to use an an xpath expression, in order to read requestId field in the xml file given below. however, this expression results in no matches. When I try to enclose the field names with single quotes, it results in a compilation error. I even tried using local-name, instead of name, in the xpath expression. I need to be able to get the value of requestId field as shown.
<int-file:outbound-channel-adapter
id="file" mode="APPEND" charset="UTF-8"
directory="C:\\Users\\dvenkat1\\Desktop\\test"
auto-create-directory="true" filename-generator-expression="#xpath(payload, '/*[name()=Envelope]/*[name()=Body]/*[name()=processArchiveRequest]/*[name()=fulfillmentRequest]/*[name()=requestHeader]/*[name()=requestID]/text()')" />
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sch="http://...schema">
<soap:Header/>
<soap:Body>
<sch:processArchiveRequest>
<sch:fulfillmentRequest>
<sch:requestHeader>
<sch:requestID>Samplereq</sch:requestID>
............
Another option would be, is to use something like this:
<int-file:outbound-channel-adapter
id="file" mode="APPEND" charset="UTF-8"
directory="C:\\Users\\dvenkat1\\Desktop\\test"
auto-create-directory="true" filename-generator-expression="#xpath(payload, 'reference exp1 here']) " />
<int-xml:xpath-expression id = "exp1"
expression="name(/soapNs:Envelope/soapNs:Body/schNs:processArchiveRequest/schNs: fulfillmentRequest/schNs:requestDetail/*[1])"
namespace-map="archiveNamespaceMap" />
<util:map id="archiveNamespaceMap">
<entry key="soapNs" value="http://www.w3.org/2003/05/soap-envelope" />
<entry key="schNs" value="http://blah../schema" />
</util:map>
It works for me like this:
filename-generator-expression="#xpath(payload, '//*[local-name()="requestID"]')"
Pay attention to the escaped " symbol.
Regarding <int-xml:xpath-expression>.
You can use it from the the filename-generator-expression as well, but you should follow with the XPathExpression and therefore use XmlPayloadConverter manually. And do that everything somewhere from the custom bean.

SharePoint - Content Query Web Part: Lookup Column Value and XSL

There is a List with Lookup field. And there is a CQWP web part which uses this list as a Source and uses custom XSL style added to Itemstyle.xsl.
And there is a problem how to render this field as a link?
Field name is 'Category' and
<xsl:value-of select="#Category" />
Returns a string with item's title (like 'Some Category'). But I need a URL or ID. Any suggestions?
Try something like this :
<a>
<xsl:attribute name="href">
<xsl:value-of select="#Url" />
</xsl:attribute>
<xsl:value-of select="#Category" />
</a>
Use disable-output-escaping, for example:
{less than symbol}xsl:value-of disable-output-escaping="yes" select="#Category" /{greater than symbol}

Resources