C# 如何从.net MVC应用程序在Monster.com上发布作业
我正在开发一个直接从我们的mvc.net应用程序发布招聘信息的解决方案。参考链接-但是运气不好,而且没有正确的步骤 我已经创建了XML,但无法继续。你能在这方面指导我吗C# 如何从.net MVC应用程序在Monster.com上发布作业,c#,.net,asp.net-mvc-4,C#,.net,Asp.net Mvc 4,我正在开发一个直接从我们的mvc.net应用程序发布招聘信息的解决方案。参考链接-但是运气不好,而且没有正确的步骤 我已经创建了XML,但无法继续。你能在这方面指导我吗 string strBuilder = "<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'><SOAP-ENV:Hea
string strBuilder = "<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'><SOAP-ENV:Header><mh:MonsterHeader xmlns:mh='http://schemas.monster.com/MonsterHeader'> <mh:MessageData> <mh:MessageId>Company Jobs created on 09/08/2011 02:41:44 PM</mh:MessageId> <mh:Timestamp>2011-09-08T14:41:44Z</mh:Timestamp> </mh:MessageData> </mh:MonsterHeader> <wsse:Security xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/04/secext'> <wsse:UsernameToken> <wsse:Username>xrtpjobsx01</wsse:Username> <wsse:Password>rtp987654</wsse:Password> </wsse:UsernameToken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> ";
// started job section
strBuilder= strBuilder+"<Job jobRefCode='myownjobreferencecode' jobAction='addOrUpdate' inventoryType='transactional' jobComplete='true' xmlns='http://schemas.monster.com/Monster' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://schemas.monster.com/Monster http://schemas.monster.com/Current/xsd/Monster.xsd'> ";
// recruiter information
strBuilder = strBuilder + "<RecruiterReference><UserName>xrtpjobsx01</UserName></RecruiterReference>";
// job information
strBuilder = strBuilder + "<JobInformation><JobTitle>Product developement manager </JobTitle><JobLevel monsterId='12'/>";
// job type, status and salary
strBuilder = strBuilder + "<JobType monsterId='1'/><JobStatus monsterId='4'/><Salary><Currency monsterId='1'/><SalaryMin>100000.00</SalaryMin><SalaryMax>150000.00</SalaryMax><CompensationType monsterId='1'/></Salary>";
// contact information
strBuilder = strBuilder + "<Contact hideAll='false' hideAddress='true' hideStreetAddress='true' hideCity='true' hideState='true' hidePostalCode='true' hideCountry='true' hideContactInfoField='false' hideCompanyName='false' hideEmailAddress='true' hideFax='true' hideName='false' hidePhone='true'><Name>John</Name>";
strBuilder = strBuilder + "<CompanyName>John's Company</CompanyName><Address><StreetAddress>1 John Street</StreetAddress><StreetAddress2>PO Box 1</StreetAddress2><City>Johnstown</City><State>PA</State><CountryCode>US</CountryCode><PostalCode>15955</PostalCode></Address><Phones><Phone phoneType='work'>999-999-9999</Phone></Phones><E-mail>john@johnscompany.com</E-mail></Contact><PhysicalAddress><StreetAddress>5 Clock Tower</StreetAddress><StreetAddress2>Suite 500</StreetAddress2><City>Maynard</City><State>MA</State><CountryCode>US</CountryCode><PostalCode>01754</PostalCode></PhysicalAddress>";
// apply online
// strBuilder = strBuilder + "<DisableApplyOnline>false</DisableApplyOnline><HideCompanyInfo>false</HideCompanyInfo>";
// job body
strBuilder = strBuilder + "<JobBody>Job body for a product development manager</JobBody><AdditionalSearchKeywords>additional search keyword</AdditionalSearchKeywords><EducationLevel monsterId='1'/>";
// apply with monster
/* strBuilder = strBuilder + "<ApplyWithMonster><DeliveryMethod monsterId='2'/><DeliveryFormat monsterId='2'/><EmailAddress>recruiter@testers.com</EmailAddress>";
strBuilder = strBuilder + "<VendorText>job vendor text</VendorText><PostURL>http://www.testdomain.com/awm/apply</PostURL><ApiKey>EAAQ3sampleMNfAK9q4</ApiKey></ApplyWithMonster>";*/
strBuilder = strBuilder + "</JobInformation>";
// job posting
strBuilder = strBuilder + "<JobPostings><JobPosting desiredDuration='60' bold='true'><InventoryPreference><Autorefresh desired='true'><Frequency>7</Frequency></Autorefresh><CareerAdNetwork desired='true'><Duration>14</Duration></CareerAdNetwork></InventoryPreference>";
strBuilder = strBuilder + "<Location><City>Boston</City><State>MA</State><CountryCode>US</CountryCode><PostalCode>02125</PostalCode></Location><JobCategory monsterId='47'/><JobOccupations><JobOccupation monsterId='11909'/></JobOccupations><BoardName monsterId='1'/><DisplayTemplate monsterId='1'/><Industries><Industry><IndustryName monsterId='1'/></Industry></Industries>";
// video
// strBuilder = strBuilder + "<Video monsterId='123' refCode='video_A'></Video>";
strBuilder = strBuilder + "</JobPosting> </JobPostings> </Job> </SOAP-ENV:Body> </SOAP-ENV:Envelope>";
string uri = "https://gateway.monster.com:8443/bgwBroker";
//HttpRequest req = new HttpRequest();
var req = WebRequest.Create(uri);
//req.Proxy = WebProxy.GetDefaultProxy(); // Enable if using proxy
req.Method = "POST"; // Post method
req.ContentType = "text/xml"; // content type
// Wrap the request stream with a text-based writer
StreamWriter writer = new StreamWriter(req.GetRequestStream());
// Write the XML text into the stream
writer.WriteLine(strBuilder);
writer.Close();
// Send the data to the webserver
var rsp = req.GetResponse();
StreamReader sr = new StreamReader(rsp.GetResponseStream());
string result = sr.ReadToEnd();
sr.Close();
Response.Write(result);
请添加到目前为止您拥有的代码。以及您得到的错误。错误为-JobBoard ID[1]对公司[34889333]无效。未提供联机应用URL。它被拖欠了。…您提供的链接表明,客户可以根据其可用的购买库存,以及客户期望的分销和目标,选择发布到以下板。这可能与您的帐户权限有关,或者没有足够的积分在主板ID[1]上发布?通过字符串连接构建XML是疯狂的。创建对象模型并将其序列化。